
obj/user/spawnhello.debug:     file format elf32-i386


Disassembly of section .text:

00800020 <_start>:
// starts us running when we are initially loaded into a new environment.
.text
.globl _start
_start:
	// See if we were started with arguments on the stack
	cmpl $USTACKTOP, %esp
  800020:	81 fc 00 e0 bf ee    	cmp    $0xeebfe000,%esp
	jne args_exist
  800026:	75 04                	jne    80002c <args_exist>

	// If not, push dummy argc/argv arguments.
	// This happens when we are loaded by the kernel,
	// because the kernel does not know about passing arguments.
	pushl $0
  800028:	6a 00                	push   $0x0
	pushl $0
  80002a:	6a 00                	push   $0x0

0080002c <args_exist>:

args_exist:
	call libmain
  80002c:	e8 4e 00 00 00       	call   80007f <libmain>
1:	jmp 1b
  800031:	eb fe                	jmp    800031 <args_exist+0x5>

00800033 <umain>:
#include <inc/lib.h>

void
umain(int argc, char **argv)
{
  800033:	f3 0f 1e fb          	endbr32 
  800037:	55                   	push   %ebp
  800038:	89 e5                	mov    %esp,%ebp
  80003a:	83 ec 10             	sub    $0x10,%esp
	int r;
	cprintf("i am parent environment %08x\n", thisenv->env_id);
  80003d:	a1 04 40 80 00       	mov    0x804004,%eax
  800042:	8b 40 48             	mov    0x48(%eax),%eax
  800045:	50                   	push   %eax
  800046:	68 20 25 80 00       	push   $0x802520
  80004b:	e8 88 01 00 00       	call   8001d8 <cprintf>
	if ((r = spawnl("hello", "hello", 0)) < 0)
  800050:	83 c4 0c             	add    $0xc,%esp
  800053:	6a 00                	push   $0x0
  800055:	68 3e 25 80 00       	push   $0x80253e
  80005a:	68 3e 25 80 00       	push   $0x80253e
  80005f:	e8 44 1b 00 00       	call   801ba8 <spawnl>
  800064:	83 c4 10             	add    $0x10,%esp
  800067:	85 c0                	test   %eax,%eax
  800069:	78 02                	js     80006d <umain+0x3a>
		panic("spawn(hello) failed: %e", r);
}
  80006b:	c9                   	leave  
  80006c:	c3                   	ret    
		panic("spawn(hello) failed: %e", r);
  80006d:	50                   	push   %eax
  80006e:	68 44 25 80 00       	push   $0x802544
  800073:	6a 09                	push   $0x9
  800075:	68 5c 25 80 00       	push   $0x80255c
  80007a:	e8 72 00 00 00       	call   8000f1 <_panic>

0080007f <libmain>:
const volatile struct Env *thisenv;
const char *binaryname = "<unknown>";

void
libmain(int argc, char **argv)
{
  80007f:	f3 0f 1e fb          	endbr32 
  800083:	55                   	push   %ebp
  800084:	89 e5                	mov    %esp,%ebp
  800086:	56                   	push   %esi
  800087:	53                   	push   %ebx
  800088:	8b 5d 08             	mov    0x8(%ebp),%ebx
  80008b:	8b 75 0c             	mov    0xc(%ebp),%esi
	;    //系统调用，我们已经在Exercise 7中实现了
	
	
	
	//屏幕上打印出来了字母，但后续报错了，有意思，让我看看问题出现在哪。
	thisenv=0;
  80008e:	c7 05 04 40 80 00 00 	movl   $0x0,0x804004
  800095:	00 00 00 
	thisenv = &envs[ENVX(sys_getenvid())];      //获取Env结构指针
  800098:	e8 10 0b 00 00       	call   800bad <sys_getenvid>
  80009d:	25 ff 03 00 00       	and    $0x3ff,%eax
  8000a2:	6b c0 7c             	imul   $0x7c,%eax,%eax
  8000a5:	05 00 00 c0 ee       	add    $0xeec00000,%eax
  8000aa:	a3 04 40 80 00       	mov    %eax,0x804004

	// save the name of the program so that panic() can use it
	if (argc > 0)
  8000af:	85 db                	test   %ebx,%ebx
  8000b1:	7e 07                	jle    8000ba <libmain+0x3b>
		binaryname = argv[0];
  8000b3:	8b 06                	mov    (%esi),%eax
  8000b5:	a3 00 30 80 00       	mov    %eax,0x803000

	// call user main routine
	umain(argc, argv);
  8000ba:	83 ec 08             	sub    $0x8,%esp
  8000bd:	56                   	push   %esi
  8000be:	53                   	push   %ebx
  8000bf:	e8 6f ff ff ff       	call   800033 <umain>

	// exit gracefully
	exit();
  8000c4:	e8 0a 00 00 00       	call   8000d3 <exit>
}
  8000c9:	83 c4 10             	add    $0x10,%esp
  8000cc:	8d 65 f8             	lea    -0x8(%ebp),%esp
  8000cf:	5b                   	pop    %ebx
  8000d0:	5e                   	pop    %esi
  8000d1:	5d                   	pop    %ebp
  8000d2:	c3                   	ret    

008000d3 <exit>:

#include <inc/lib.h>

void
exit(void)
{
  8000d3:	f3 0f 1e fb          	endbr32 
  8000d7:	55                   	push   %ebp
  8000d8:	89 e5                	mov    %esp,%ebp
  8000da:	83 ec 08             	sub    $0x8,%esp
	close_all();
  8000dd:	e8 11 0f 00 00       	call   800ff3 <close_all>
	sys_env_destroy(0);
  8000e2:	83 ec 0c             	sub    $0xc,%esp
  8000e5:	6a 00                	push   $0x0
  8000e7:	e8 7c 0a 00 00       	call   800b68 <sys_env_destroy>
}
  8000ec:	83 c4 10             	add    $0x10,%esp
  8000ef:	c9                   	leave  
  8000f0:	c3                   	ret    

008000f1 <_panic>:
 * It prints "panic: <message>", then causes a breakpoint exception,
 * which causes JOS to enter the JOS kernel monitor.
 */
void
_panic(const char *file, int line, const char *fmt, ...)
{
  8000f1:	f3 0f 1e fb          	endbr32 
  8000f5:	55                   	push   %ebp
  8000f6:	89 e5                	mov    %esp,%ebp
  8000f8:	56                   	push   %esi
  8000f9:	53                   	push   %ebx
	va_list ap;

	va_start(ap, fmt);
  8000fa:	8d 5d 14             	lea    0x14(%ebp),%ebx

	// Print the panic message
	cprintf("[%08x] user panic in %s at %s:%d: ",
  8000fd:	8b 35 00 30 80 00    	mov    0x803000,%esi
  800103:	e8 a5 0a 00 00       	call   800bad <sys_getenvid>
  800108:	83 ec 0c             	sub    $0xc,%esp
  80010b:	ff 75 0c             	pushl  0xc(%ebp)
  80010e:	ff 75 08             	pushl  0x8(%ebp)
  800111:	56                   	push   %esi
  800112:	50                   	push   %eax
  800113:	68 78 25 80 00       	push   $0x802578
  800118:	e8 bb 00 00 00       	call   8001d8 <cprintf>
		sys_getenvid(), binaryname, file, line);
	vcprintf(fmt, ap);
  80011d:	83 c4 18             	add    $0x18,%esp
  800120:	53                   	push   %ebx
  800121:	ff 75 10             	pushl  0x10(%ebp)
  800124:	e8 5a 00 00 00       	call   800183 <vcprintf>
	cprintf("\n");
  800129:	c7 04 24 3e 2a 80 00 	movl   $0x802a3e,(%esp)
  800130:	e8 a3 00 00 00       	call   8001d8 <cprintf>
  800135:	83 c4 10             	add    $0x10,%esp

	// Cause a breakpoint exception
	while (1)
		asm volatile("int3");
  800138:	cc                   	int3   
  800139:	eb fd                	jmp    800138 <_panic+0x47>

0080013b <putch>:
};


static void
putch(int ch, struct printbuf *b)
{
  80013b:	f3 0f 1e fb          	endbr32 
  80013f:	55                   	push   %ebp
  800140:	89 e5                	mov    %esp,%ebp
  800142:	53                   	push   %ebx
  800143:	83 ec 04             	sub    $0x4,%esp
  800146:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	b->buf[b->idx++] = ch;
  800149:	8b 13                	mov    (%ebx),%edx
  80014b:	8d 42 01             	lea    0x1(%edx),%eax
  80014e:	89 03                	mov    %eax,(%ebx)
  800150:	8b 4d 08             	mov    0x8(%ebp),%ecx
  800153:	88 4c 13 08          	mov    %cl,0x8(%ebx,%edx,1)
	if (b->idx == 256-1) {
  800157:	3d ff 00 00 00       	cmp    $0xff,%eax
  80015c:	74 09                	je     800167 <putch+0x2c>
		sys_cputs(b->buf, b->idx);
		b->idx = 0;
	}
	b->cnt++;
  80015e:	83 43 04 01          	addl   $0x1,0x4(%ebx)
}
  800162:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  800165:	c9                   	leave  
  800166:	c3                   	ret    
		sys_cputs(b->buf, b->idx);
  800167:	83 ec 08             	sub    $0x8,%esp
  80016a:	68 ff 00 00 00       	push   $0xff
  80016f:	8d 43 08             	lea    0x8(%ebx),%eax
  800172:	50                   	push   %eax
  800173:	e8 ab 09 00 00       	call   800b23 <sys_cputs>
		b->idx = 0;
  800178:	c7 03 00 00 00 00    	movl   $0x0,(%ebx)
  80017e:	83 c4 10             	add    $0x10,%esp
  800181:	eb db                	jmp    80015e <putch+0x23>

00800183 <vcprintf>:

int
vcprintf(const char *fmt, va_list ap)
{
  800183:	f3 0f 1e fb          	endbr32 
  800187:	55                   	push   %ebp
  800188:	89 e5                	mov    %esp,%ebp
  80018a:	81 ec 18 01 00 00    	sub    $0x118,%esp
	struct printbuf b;

	b.idx = 0;
  800190:	c7 85 f0 fe ff ff 00 	movl   $0x0,-0x110(%ebp)
  800197:	00 00 00 
	b.cnt = 0;
  80019a:	c7 85 f4 fe ff ff 00 	movl   $0x0,-0x10c(%ebp)
  8001a1:	00 00 00 
	vprintfmt((void*)putch, &b, fmt, ap);
  8001a4:	ff 75 0c             	pushl  0xc(%ebp)
  8001a7:	ff 75 08             	pushl  0x8(%ebp)
  8001aa:	8d 85 f0 fe ff ff    	lea    -0x110(%ebp),%eax
  8001b0:	50                   	push   %eax
  8001b1:	68 3b 01 80 00       	push   $0x80013b
  8001b6:	e8 20 01 00 00       	call   8002db <vprintfmt>
	sys_cputs(b.buf, b.idx);
  8001bb:	83 c4 08             	add    $0x8,%esp
  8001be:	ff b5 f0 fe ff ff    	pushl  -0x110(%ebp)
  8001c4:	8d 85 f8 fe ff ff    	lea    -0x108(%ebp),%eax
  8001ca:	50                   	push   %eax
  8001cb:	e8 53 09 00 00       	call   800b23 <sys_cputs>

	return b.cnt;
}
  8001d0:	8b 85 f4 fe ff ff    	mov    -0x10c(%ebp),%eax
  8001d6:	c9                   	leave  
  8001d7:	c3                   	ret    

008001d8 <cprintf>:

int
cprintf(const char *fmt, ...)
{
  8001d8:	f3 0f 1e fb          	endbr32 
  8001dc:	55                   	push   %ebp
  8001dd:	89 e5                	mov    %esp,%ebp
  8001df:	83 ec 10             	sub    $0x10,%esp
	va_list ap;
	int cnt;

	va_start(ap, fmt);
  8001e2:	8d 45 0c             	lea    0xc(%ebp),%eax
	cnt = vcprintf(fmt, ap);
  8001e5:	50                   	push   %eax
  8001e6:	ff 75 08             	pushl  0x8(%ebp)
  8001e9:	e8 95 ff ff ff       	call   800183 <vcprintf>
	va_end(ap);

	return cnt;
}
  8001ee:	c9                   	leave  
  8001ef:	c3                   	ret    

008001f0 <printnum>:
 * using specified putch function and associated pointer putdat.
 */
static void
printnum(void (*putch)(int, void*), void *putdat,
	 unsigned long long num, unsigned base, int width, int padc)
{
  8001f0:	55                   	push   %ebp
  8001f1:	89 e5                	mov    %esp,%ebp
  8001f3:	57                   	push   %edi
  8001f4:	56                   	push   %esi
  8001f5:	53                   	push   %ebx
  8001f6:	83 ec 1c             	sub    $0x1c,%esp
  8001f9:	89 c7                	mov    %eax,%edi
  8001fb:	89 d6                	mov    %edx,%esi
  8001fd:	8b 45 08             	mov    0x8(%ebp),%eax
  800200:	8b 55 0c             	mov    0xc(%ebp),%edx
  800203:	89 d1                	mov    %edx,%ecx
  800205:	89 c2                	mov    %eax,%edx
  800207:	89 45 d8             	mov    %eax,-0x28(%ebp)
  80020a:	89 4d dc             	mov    %ecx,-0x24(%ebp)
  80020d:	8b 45 10             	mov    0x10(%ebp),%eax
  800210:	8b 5d 14             	mov    0x14(%ebp),%ebx
	// first recursively print all preceding (more significant) digits
	if (num >= base) {
  800213:	89 45 e0             	mov    %eax,-0x20(%ebp)
  800216:	c7 45 e4 00 00 00 00 	movl   $0x0,-0x1c(%ebp)
  80021d:	39 c2                	cmp    %eax,%edx
  80021f:	1b 4d e4             	sbb    -0x1c(%ebp),%ecx
  800222:	72 3e                	jb     800262 <printnum+0x72>
		printnum(putch, putdat, num / base, base, width - 1, padc);
  800224:	83 ec 0c             	sub    $0xc,%esp
  800227:	ff 75 18             	pushl  0x18(%ebp)
  80022a:	83 eb 01             	sub    $0x1,%ebx
  80022d:	53                   	push   %ebx
  80022e:	50                   	push   %eax
  80022f:	83 ec 08             	sub    $0x8,%esp
  800232:	ff 75 e4             	pushl  -0x1c(%ebp)
  800235:	ff 75 e0             	pushl  -0x20(%ebp)
  800238:	ff 75 dc             	pushl  -0x24(%ebp)
  80023b:	ff 75 d8             	pushl  -0x28(%ebp)
  80023e:	e8 6d 20 00 00       	call   8022b0 <__udivdi3>
  800243:	83 c4 18             	add    $0x18,%esp
  800246:	52                   	push   %edx
  800247:	50                   	push   %eax
  800248:	89 f2                	mov    %esi,%edx
  80024a:	89 f8                	mov    %edi,%eax
  80024c:	e8 9f ff ff ff       	call   8001f0 <printnum>
  800251:	83 c4 20             	add    $0x20,%esp
  800254:	eb 13                	jmp    800269 <printnum+0x79>
	} else {
		// print any needed pad characters before first digit
		while (--width > 0)
			putch(padc, putdat);
  800256:	83 ec 08             	sub    $0x8,%esp
  800259:	56                   	push   %esi
  80025a:	ff 75 18             	pushl  0x18(%ebp)
  80025d:	ff d7                	call   *%edi
  80025f:	83 c4 10             	add    $0x10,%esp
		while (--width > 0)
  800262:	83 eb 01             	sub    $0x1,%ebx
  800265:	85 db                	test   %ebx,%ebx
  800267:	7f ed                	jg     800256 <printnum+0x66>
	}

	// then print this (the least significant) digit
	putch("0123456789abcdef"[num % base], putdat);
  800269:	83 ec 08             	sub    $0x8,%esp
  80026c:	56                   	push   %esi
  80026d:	83 ec 04             	sub    $0x4,%esp
  800270:	ff 75 e4             	pushl  -0x1c(%ebp)
  800273:	ff 75 e0             	pushl  -0x20(%ebp)
  800276:	ff 75 dc             	pushl  -0x24(%ebp)
  800279:	ff 75 d8             	pushl  -0x28(%ebp)
  80027c:	e8 3f 21 00 00       	call   8023c0 <__umoddi3>
  800281:	83 c4 14             	add    $0x14,%esp
  800284:	0f be 80 9b 25 80 00 	movsbl 0x80259b(%eax),%eax
  80028b:	50                   	push   %eax
  80028c:	ff d7                	call   *%edi
}
  80028e:	83 c4 10             	add    $0x10,%esp
  800291:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800294:	5b                   	pop    %ebx
  800295:	5e                   	pop    %esi
  800296:	5f                   	pop    %edi
  800297:	5d                   	pop    %ebp
  800298:	c3                   	ret    

00800299 <sprintputch>:
	int cnt;
};

static void
sprintputch(int ch, struct sprintbuf *b)
{
  800299:	f3 0f 1e fb          	endbr32 
  80029d:	55                   	push   %ebp
  80029e:	89 e5                	mov    %esp,%ebp
  8002a0:	8b 45 0c             	mov    0xc(%ebp),%eax
	b->cnt++;
  8002a3:	83 40 08 01          	addl   $0x1,0x8(%eax)
	if (b->buf < b->ebuf)
  8002a7:	8b 10                	mov    (%eax),%edx
  8002a9:	3b 50 04             	cmp    0x4(%eax),%edx
  8002ac:	73 0a                	jae    8002b8 <sprintputch+0x1f>
		*b->buf++ = ch;
  8002ae:	8d 4a 01             	lea    0x1(%edx),%ecx
  8002b1:	89 08                	mov    %ecx,(%eax)
  8002b3:	8b 45 08             	mov    0x8(%ebp),%eax
  8002b6:	88 02                	mov    %al,(%edx)
}
  8002b8:	5d                   	pop    %ebp
  8002b9:	c3                   	ret    

008002ba <printfmt>:
{
  8002ba:	f3 0f 1e fb          	endbr32 
  8002be:	55                   	push   %ebp
  8002bf:	89 e5                	mov    %esp,%ebp
  8002c1:	83 ec 08             	sub    $0x8,%esp
	va_start(ap, fmt);
  8002c4:	8d 45 14             	lea    0x14(%ebp),%eax
	vprintfmt(putch, putdat, fmt, ap);
  8002c7:	50                   	push   %eax
  8002c8:	ff 75 10             	pushl  0x10(%ebp)
  8002cb:	ff 75 0c             	pushl  0xc(%ebp)
  8002ce:	ff 75 08             	pushl  0x8(%ebp)
  8002d1:	e8 05 00 00 00       	call   8002db <vprintfmt>
}
  8002d6:	83 c4 10             	add    $0x10,%esp
  8002d9:	c9                   	leave  
  8002da:	c3                   	ret    

008002db <vprintfmt>:
{
  8002db:	f3 0f 1e fb          	endbr32 
  8002df:	55                   	push   %ebp
  8002e0:	89 e5                	mov    %esp,%ebp
  8002e2:	57                   	push   %edi
  8002e3:	56                   	push   %esi
  8002e4:	53                   	push   %ebx
  8002e5:	83 ec 3c             	sub    $0x3c,%esp
  8002e8:	8b 75 08             	mov    0x8(%ebp),%esi
  8002eb:	8b 5d 0c             	mov    0xc(%ebp),%ebx
  8002ee:	8b 7d 10             	mov    0x10(%ebp),%edi
  8002f1:	e9 5d 03 00 00       	jmp    800653 <vprintfmt+0x378>
		padc = ' ';
  8002f6:	c6 45 d3 20          	movb   $0x20,-0x2d(%ebp)
		altflag = 0;
  8002fa:	c7 45 e0 00 00 00 00 	movl   $0x0,-0x20(%ebp)
		precision = -1;
  800301:	c7 45 d8 ff ff ff ff 	movl   $0xffffffff,-0x28(%ebp)
		width = -1;
  800308:	c7 45 d4 ff ff ff ff 	movl   $0xffffffff,-0x2c(%ebp)
		lflag = 0;
  80030f:	b9 00 00 00 00       	mov    $0x0,%ecx
		switch (ch = *(unsigned char *) fmt++) {
  800314:	8d 47 01             	lea    0x1(%edi),%eax
  800317:	89 45 e4             	mov    %eax,-0x1c(%ebp)
  80031a:	0f b6 17             	movzbl (%edi),%edx
  80031d:	8d 42 dd             	lea    -0x23(%edx),%eax
  800320:	3c 55                	cmp    $0x55,%al
  800322:	0f 87 ae 03 00 00    	ja     8006d6 <vprintfmt+0x3fb>
  800328:	0f b6 c0             	movzbl %al,%eax
  80032b:	3e ff 24 85 e0 26 80 	notrack jmp *0x8026e0(,%eax,4)
  800332:	00 
  800333:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			padc = '-';
  800336:	c6 45 d3 2d          	movb   $0x2d,-0x2d(%ebp)
  80033a:	eb d8                	jmp    800314 <vprintfmt+0x39>
		switch (ch = *(unsigned char *) fmt++) {
  80033c:	8b 7d e4             	mov    -0x1c(%ebp),%edi
  80033f:	c6 45 d3 30          	movb   $0x30,-0x2d(%ebp)
  800343:	eb cf                	jmp    800314 <vprintfmt+0x39>
  800345:	0f b6 d2             	movzbl %dl,%edx
  800348:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			for (precision = 0; ; ++fmt) {
  80034b:	b8 00 00 00 00       	mov    $0x0,%eax
  800350:	89 4d e4             	mov    %ecx,-0x1c(%ebp)
				precision = precision * 10 + ch - '0';
  800353:	8d 04 80             	lea    (%eax,%eax,4),%eax
  800356:	8d 44 42 d0          	lea    -0x30(%edx,%eax,2),%eax
				ch = *fmt;
  80035a:	0f be 17             	movsbl (%edi),%edx
				if (ch < '0' || ch > '9')
  80035d:	8d 4a d0             	lea    -0x30(%edx),%ecx
  800360:	83 f9 09             	cmp    $0x9,%ecx
  800363:	77 55                	ja     8003ba <vprintfmt+0xdf>
			for (precision = 0; ; ++fmt) {
  800365:	83 c7 01             	add    $0x1,%edi
				precision = precision * 10 + ch - '0';
  800368:	eb e9                	jmp    800353 <vprintfmt+0x78>
			precision = va_arg(ap, int);
  80036a:	8b 45 14             	mov    0x14(%ebp),%eax
  80036d:	8b 00                	mov    (%eax),%eax
  80036f:	89 45 d8             	mov    %eax,-0x28(%ebp)
  800372:	8b 45 14             	mov    0x14(%ebp),%eax
  800375:	8d 40 04             	lea    0x4(%eax),%eax
  800378:	89 45 14             	mov    %eax,0x14(%ebp)
		switch (ch = *(unsigned char *) fmt++) {
  80037b:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			if (width < 0)
  80037e:	83 7d d4 00          	cmpl   $0x0,-0x2c(%ebp)
  800382:	79 90                	jns    800314 <vprintfmt+0x39>
				width = precision, precision = -1;
  800384:	8b 45 d8             	mov    -0x28(%ebp),%eax
  800387:	89 45 d4             	mov    %eax,-0x2c(%ebp)
  80038a:	c7 45 d8 ff ff ff ff 	movl   $0xffffffff,-0x28(%ebp)
  800391:	eb 81                	jmp    800314 <vprintfmt+0x39>
  800393:	8b 45 d4             	mov    -0x2c(%ebp),%eax
  800396:	85 c0                	test   %eax,%eax
  800398:	ba 00 00 00 00       	mov    $0x0,%edx
  80039d:	0f 49 d0             	cmovns %eax,%edx
  8003a0:	89 55 d4             	mov    %edx,-0x2c(%ebp)
		switch (ch = *(unsigned char *) fmt++) {
  8003a3:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			goto reswitch;
  8003a6:	e9 69 ff ff ff       	jmp    800314 <vprintfmt+0x39>
		switch (ch = *(unsigned char *) fmt++) {
  8003ab:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			altflag = 1;
  8003ae:	c7 45 e0 01 00 00 00 	movl   $0x1,-0x20(%ebp)
			goto reswitch;
  8003b5:	e9 5a ff ff ff       	jmp    800314 <vprintfmt+0x39>
  8003ba:	8b 4d e4             	mov    -0x1c(%ebp),%ecx
  8003bd:	89 45 d8             	mov    %eax,-0x28(%ebp)
  8003c0:	eb bc                	jmp    80037e <vprintfmt+0xa3>
			lflag++;
  8003c2:	83 c1 01             	add    $0x1,%ecx
		switch (ch = *(unsigned char *) fmt++) {
  8003c5:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			goto reswitch;
  8003c8:	e9 47 ff ff ff       	jmp    800314 <vprintfmt+0x39>
			putch(va_arg(ap, int), putdat);
  8003cd:	8b 45 14             	mov    0x14(%ebp),%eax
  8003d0:	8d 78 04             	lea    0x4(%eax),%edi
  8003d3:	83 ec 08             	sub    $0x8,%esp
  8003d6:	53                   	push   %ebx
  8003d7:	ff 30                	pushl  (%eax)
  8003d9:	ff d6                	call   *%esi
			break;
  8003db:	83 c4 10             	add    $0x10,%esp
			putch(va_arg(ap, int), putdat);
  8003de:	89 7d 14             	mov    %edi,0x14(%ebp)
			break;
  8003e1:	e9 6a 02 00 00       	jmp    800650 <vprintfmt+0x375>
			err = va_arg(ap, int);
  8003e6:	8b 45 14             	mov    0x14(%ebp),%eax
  8003e9:	8d 78 04             	lea    0x4(%eax),%edi
  8003ec:	8b 00                	mov    (%eax),%eax
  8003ee:	99                   	cltd   
  8003ef:	31 d0                	xor    %edx,%eax
  8003f1:	29 d0                	sub    %edx,%eax
			if (err >= MAXERROR || (p = error_string[err]) == NULL)
  8003f3:	83 f8 0f             	cmp    $0xf,%eax
  8003f6:	7f 23                	jg     80041b <vprintfmt+0x140>
  8003f8:	8b 14 85 40 28 80 00 	mov    0x802840(,%eax,4),%edx
  8003ff:	85 d2                	test   %edx,%edx
  800401:	74 18                	je     80041b <vprintfmt+0x140>
				printfmt(putch, putdat, "%s", p);
  800403:	52                   	push   %edx
  800404:	68 71 29 80 00       	push   $0x802971
  800409:	53                   	push   %ebx
  80040a:	56                   	push   %esi
  80040b:	e8 aa fe ff ff       	call   8002ba <printfmt>
  800410:	83 c4 10             	add    $0x10,%esp
			err = va_arg(ap, int);
  800413:	89 7d 14             	mov    %edi,0x14(%ebp)
  800416:	e9 35 02 00 00       	jmp    800650 <vprintfmt+0x375>
				printfmt(putch, putdat, "error %d", err);
  80041b:	50                   	push   %eax
  80041c:	68 b3 25 80 00       	push   $0x8025b3
  800421:	53                   	push   %ebx
  800422:	56                   	push   %esi
  800423:	e8 92 fe ff ff       	call   8002ba <printfmt>
  800428:	83 c4 10             	add    $0x10,%esp
			err = va_arg(ap, int);
  80042b:	89 7d 14             	mov    %edi,0x14(%ebp)
				printfmt(putch, putdat, "error %d", err);
  80042e:	e9 1d 02 00 00       	jmp    800650 <vprintfmt+0x375>
			if ((p = va_arg(ap, char *)) == NULL)
  800433:	8b 45 14             	mov    0x14(%ebp),%eax
  800436:	83 c0 04             	add    $0x4,%eax
  800439:	89 45 c8             	mov    %eax,-0x38(%ebp)
  80043c:	8b 45 14             	mov    0x14(%ebp),%eax
  80043f:	8b 10                	mov    (%eax),%edx
				p = "(null)";
  800441:	85 d2                	test   %edx,%edx
  800443:	b8 ac 25 80 00       	mov    $0x8025ac,%eax
  800448:	0f 45 c2             	cmovne %edx,%eax
  80044b:	89 45 cc             	mov    %eax,-0x34(%ebp)
			if (width > 0 && padc != '-')
  80044e:	83 7d d4 00          	cmpl   $0x0,-0x2c(%ebp)
  800452:	7e 06                	jle    80045a <vprintfmt+0x17f>
  800454:	80 7d d3 2d          	cmpb   $0x2d,-0x2d(%ebp)
  800458:	75 0d                	jne    800467 <vprintfmt+0x18c>
				for (width -= strnlen(p, precision); width > 0; width--)
  80045a:	8b 45 cc             	mov    -0x34(%ebp),%eax
  80045d:	89 c7                	mov    %eax,%edi
  80045f:	03 45 d4             	add    -0x2c(%ebp),%eax
  800462:	89 45 d4             	mov    %eax,-0x2c(%ebp)
  800465:	eb 55                	jmp    8004bc <vprintfmt+0x1e1>
  800467:	83 ec 08             	sub    $0x8,%esp
  80046a:	ff 75 d8             	pushl  -0x28(%ebp)
  80046d:	ff 75 cc             	pushl  -0x34(%ebp)
  800470:	e8 15 03 00 00       	call   80078a <strnlen>
  800475:	8b 55 d4             	mov    -0x2c(%ebp),%edx
  800478:	29 c2                	sub    %eax,%edx
  80047a:	89 55 c4             	mov    %edx,-0x3c(%ebp)
  80047d:	83 c4 10             	add    $0x10,%esp
  800480:	89 d7                	mov    %edx,%edi
					putch(padc, putdat);
  800482:	0f be 45 d3          	movsbl -0x2d(%ebp),%eax
  800486:	89 45 d4             	mov    %eax,-0x2c(%ebp)
				for (width -= strnlen(p, precision); width > 0; width--)
  800489:	85 ff                	test   %edi,%edi
  80048b:	7e 11                	jle    80049e <vprintfmt+0x1c3>
					putch(padc, putdat);
  80048d:	83 ec 08             	sub    $0x8,%esp
  800490:	53                   	push   %ebx
  800491:	ff 75 d4             	pushl  -0x2c(%ebp)
  800494:	ff d6                	call   *%esi
				for (width -= strnlen(p, precision); width > 0; width--)
  800496:	83 ef 01             	sub    $0x1,%edi
  800499:	83 c4 10             	add    $0x10,%esp
  80049c:	eb eb                	jmp    800489 <vprintfmt+0x1ae>
  80049e:	8b 55 c4             	mov    -0x3c(%ebp),%edx
  8004a1:	85 d2                	test   %edx,%edx
  8004a3:	b8 00 00 00 00       	mov    $0x0,%eax
  8004a8:	0f 49 c2             	cmovns %edx,%eax
  8004ab:	29 c2                	sub    %eax,%edx
  8004ad:	89 55 d4             	mov    %edx,-0x2c(%ebp)
  8004b0:	eb a8                	jmp    80045a <vprintfmt+0x17f>
					putch(ch, putdat);
  8004b2:	83 ec 08             	sub    $0x8,%esp
  8004b5:	53                   	push   %ebx
  8004b6:	52                   	push   %edx
  8004b7:	ff d6                	call   *%esi
  8004b9:	83 c4 10             	add    $0x10,%esp
  8004bc:	8b 4d d4             	mov    -0x2c(%ebp),%ecx
  8004bf:	29 f9                	sub    %edi,%ecx
			for (; (ch = *p++) != '\0' && (precision < 0 || --precision >= 0); width--)
  8004c1:	83 c7 01             	add    $0x1,%edi
  8004c4:	0f b6 47 ff          	movzbl -0x1(%edi),%eax
  8004c8:	0f be d0             	movsbl %al,%edx
  8004cb:	85 d2                	test   %edx,%edx
  8004cd:	74 4b                	je     80051a <vprintfmt+0x23f>
  8004cf:	83 7d d8 00          	cmpl   $0x0,-0x28(%ebp)
  8004d3:	78 06                	js     8004db <vprintfmt+0x200>
  8004d5:	83 6d d8 01          	subl   $0x1,-0x28(%ebp)
  8004d9:	78 1e                	js     8004f9 <vprintfmt+0x21e>
				if (altflag && (ch < ' ' || ch > '~'))
  8004db:	83 7d e0 00          	cmpl   $0x0,-0x20(%ebp)
  8004df:	74 d1                	je     8004b2 <vprintfmt+0x1d7>
  8004e1:	0f be c0             	movsbl %al,%eax
  8004e4:	83 e8 20             	sub    $0x20,%eax
  8004e7:	83 f8 5e             	cmp    $0x5e,%eax
  8004ea:	76 c6                	jbe    8004b2 <vprintfmt+0x1d7>
					putch('?', putdat);
  8004ec:	83 ec 08             	sub    $0x8,%esp
  8004ef:	53                   	push   %ebx
  8004f0:	6a 3f                	push   $0x3f
  8004f2:	ff d6                	call   *%esi
  8004f4:	83 c4 10             	add    $0x10,%esp
  8004f7:	eb c3                	jmp    8004bc <vprintfmt+0x1e1>
  8004f9:	89 cf                	mov    %ecx,%edi
  8004fb:	eb 0e                	jmp    80050b <vprintfmt+0x230>
				putch(' ', putdat);
  8004fd:	83 ec 08             	sub    $0x8,%esp
  800500:	53                   	push   %ebx
  800501:	6a 20                	push   $0x20
  800503:	ff d6                	call   *%esi
			for (; width > 0; width--)
  800505:	83 ef 01             	sub    $0x1,%edi
  800508:	83 c4 10             	add    $0x10,%esp
  80050b:	85 ff                	test   %edi,%edi
  80050d:	7f ee                	jg     8004fd <vprintfmt+0x222>
			if ((p = va_arg(ap, char *)) == NULL)
  80050f:	8b 45 c8             	mov    -0x38(%ebp),%eax
  800512:	89 45 14             	mov    %eax,0x14(%ebp)
  800515:	e9 36 01 00 00       	jmp    800650 <vprintfmt+0x375>
  80051a:	89 cf                	mov    %ecx,%edi
  80051c:	eb ed                	jmp    80050b <vprintfmt+0x230>
	if (lflag >= 2)
  80051e:	83 f9 01             	cmp    $0x1,%ecx
  800521:	7f 1f                	jg     800542 <vprintfmt+0x267>
	else if (lflag)
  800523:	85 c9                	test   %ecx,%ecx
  800525:	74 67                	je     80058e <vprintfmt+0x2b3>
		return va_arg(*ap, long);
  800527:	8b 45 14             	mov    0x14(%ebp),%eax
  80052a:	8b 00                	mov    (%eax),%eax
  80052c:	89 45 d8             	mov    %eax,-0x28(%ebp)
  80052f:	89 c1                	mov    %eax,%ecx
  800531:	c1 f9 1f             	sar    $0x1f,%ecx
  800534:	89 4d dc             	mov    %ecx,-0x24(%ebp)
  800537:	8b 45 14             	mov    0x14(%ebp),%eax
  80053a:	8d 40 04             	lea    0x4(%eax),%eax
  80053d:	89 45 14             	mov    %eax,0x14(%ebp)
  800540:	eb 17                	jmp    800559 <vprintfmt+0x27e>
		return va_arg(*ap, long long);
  800542:	8b 45 14             	mov    0x14(%ebp),%eax
  800545:	8b 50 04             	mov    0x4(%eax),%edx
  800548:	8b 00                	mov    (%eax),%eax
  80054a:	89 45 d8             	mov    %eax,-0x28(%ebp)
  80054d:	89 55 dc             	mov    %edx,-0x24(%ebp)
  800550:	8b 45 14             	mov    0x14(%ebp),%eax
  800553:	8d 40 08             	lea    0x8(%eax),%eax
  800556:	89 45 14             	mov    %eax,0x14(%ebp)
			if ((long long) num < 0) {
  800559:	8b 55 d8             	mov    -0x28(%ebp),%edx
  80055c:	8b 4d dc             	mov    -0x24(%ebp),%ecx
			base = 10;
  80055f:	b8 0a 00 00 00       	mov    $0xa,%eax
			if ((long long) num < 0) {
  800564:	85 c9                	test   %ecx,%ecx
  800566:	0f 89 ca 00 00 00    	jns    800636 <vprintfmt+0x35b>
				putch('-', putdat);
  80056c:	83 ec 08             	sub    $0x8,%esp
  80056f:	53                   	push   %ebx
  800570:	6a 2d                	push   $0x2d
  800572:	ff d6                	call   *%esi
				num = -(long long) num;
  800574:	8b 55 d8             	mov    -0x28(%ebp),%edx
  800577:	8b 4d dc             	mov    -0x24(%ebp),%ecx
  80057a:	f7 da                	neg    %edx
  80057c:	83 d1 00             	adc    $0x0,%ecx
  80057f:	f7 d9                	neg    %ecx
  800581:	83 c4 10             	add    $0x10,%esp
			base = 10;
  800584:	b8 0a 00 00 00       	mov    $0xa,%eax
  800589:	e9 a8 00 00 00       	jmp    800636 <vprintfmt+0x35b>
		return va_arg(*ap, int);
  80058e:	8b 45 14             	mov    0x14(%ebp),%eax
  800591:	8b 00                	mov    (%eax),%eax
  800593:	89 45 d8             	mov    %eax,-0x28(%ebp)
  800596:	99                   	cltd   
  800597:	89 55 dc             	mov    %edx,-0x24(%ebp)
  80059a:	8b 45 14             	mov    0x14(%ebp),%eax
  80059d:	8d 40 04             	lea    0x4(%eax),%eax
  8005a0:	89 45 14             	mov    %eax,0x14(%ebp)
  8005a3:	eb b4                	jmp    800559 <vprintfmt+0x27e>
	if (lflag >= 2)
  8005a5:	83 f9 01             	cmp    $0x1,%ecx
  8005a8:	7f 1b                	jg     8005c5 <vprintfmt+0x2ea>
	else if (lflag)
  8005aa:	85 c9                	test   %ecx,%ecx
  8005ac:	74 2c                	je     8005da <vprintfmt+0x2ff>
		return va_arg(*ap, unsigned long);
  8005ae:	8b 45 14             	mov    0x14(%ebp),%eax
  8005b1:	8b 10                	mov    (%eax),%edx
  8005b3:	b9 00 00 00 00       	mov    $0x0,%ecx
  8005b8:	8d 40 04             	lea    0x4(%eax),%eax
  8005bb:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 10;
  8005be:	b8 0a 00 00 00       	mov    $0xa,%eax
		return va_arg(*ap, unsigned long);
  8005c3:	eb 71                	jmp    800636 <vprintfmt+0x35b>
		return va_arg(*ap, unsigned long long);
  8005c5:	8b 45 14             	mov    0x14(%ebp),%eax
  8005c8:	8b 10                	mov    (%eax),%edx
  8005ca:	8b 48 04             	mov    0x4(%eax),%ecx
  8005cd:	8d 40 08             	lea    0x8(%eax),%eax
  8005d0:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 10;
  8005d3:	b8 0a 00 00 00       	mov    $0xa,%eax
		return va_arg(*ap, unsigned long long);
  8005d8:	eb 5c                	jmp    800636 <vprintfmt+0x35b>
		return va_arg(*ap, unsigned int);
  8005da:	8b 45 14             	mov    0x14(%ebp),%eax
  8005dd:	8b 10                	mov    (%eax),%edx
  8005df:	b9 00 00 00 00       	mov    $0x0,%ecx
  8005e4:	8d 40 04             	lea    0x4(%eax),%eax
  8005e7:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 10;
  8005ea:	b8 0a 00 00 00       	mov    $0xa,%eax
		return va_arg(*ap, unsigned int);
  8005ef:	eb 45                	jmp    800636 <vprintfmt+0x35b>
			putch('X', putdat);
  8005f1:	83 ec 08             	sub    $0x8,%esp
  8005f4:	53                   	push   %ebx
  8005f5:	6a 58                	push   $0x58
  8005f7:	ff d6                	call   *%esi
			putch('X', putdat);
  8005f9:	83 c4 08             	add    $0x8,%esp
  8005fc:	53                   	push   %ebx
  8005fd:	6a 58                	push   $0x58
  8005ff:	ff d6                	call   *%esi
			putch('X', putdat);
  800601:	83 c4 08             	add    $0x8,%esp
  800604:	53                   	push   %ebx
  800605:	6a 58                	push   $0x58
  800607:	ff d6                	call   *%esi
			break;
  800609:	83 c4 10             	add    $0x10,%esp
  80060c:	eb 42                	jmp    800650 <vprintfmt+0x375>
			putch('0', putdat);
  80060e:	83 ec 08             	sub    $0x8,%esp
  800611:	53                   	push   %ebx
  800612:	6a 30                	push   $0x30
  800614:	ff d6                	call   *%esi
			putch('x', putdat);
  800616:	83 c4 08             	add    $0x8,%esp
  800619:	53                   	push   %ebx
  80061a:	6a 78                	push   $0x78
  80061c:	ff d6                	call   *%esi
			num = (unsigned long long)
  80061e:	8b 45 14             	mov    0x14(%ebp),%eax
  800621:	8b 10                	mov    (%eax),%edx
  800623:	b9 00 00 00 00       	mov    $0x0,%ecx
			goto number;
  800628:	83 c4 10             	add    $0x10,%esp
				(uintptr_t) va_arg(ap, void *);
  80062b:	8d 40 04             	lea    0x4(%eax),%eax
  80062e:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 16;
  800631:	b8 10 00 00 00       	mov    $0x10,%eax
			printnum(putch, putdat, num, base, width, padc);
  800636:	83 ec 0c             	sub    $0xc,%esp
  800639:	0f be 7d d3          	movsbl -0x2d(%ebp),%edi
  80063d:	57                   	push   %edi
  80063e:	ff 75 d4             	pushl  -0x2c(%ebp)
  800641:	50                   	push   %eax
  800642:	51                   	push   %ecx
  800643:	52                   	push   %edx
  800644:	89 da                	mov    %ebx,%edx
  800646:	89 f0                	mov    %esi,%eax
  800648:	e8 a3 fb ff ff       	call   8001f0 <printnum>
			break;
  80064d:	83 c4 20             	add    $0x20,%esp
			if ((p = va_arg(ap, char *)) == NULL)
  800650:	8b 7d e4             	mov    -0x1c(%ebp),%edi
		while ((ch = *(unsigned char *) fmt++) != '%') {
  800653:	83 c7 01             	add    $0x1,%edi
  800656:	0f b6 47 ff          	movzbl -0x1(%edi),%eax
  80065a:	83 f8 25             	cmp    $0x25,%eax
  80065d:	0f 84 93 fc ff ff    	je     8002f6 <vprintfmt+0x1b>
			if (ch == '\0')
  800663:	85 c0                	test   %eax,%eax
  800665:	0f 84 8b 00 00 00    	je     8006f6 <vprintfmt+0x41b>
			putch(ch, putdat);
  80066b:	83 ec 08             	sub    $0x8,%esp
  80066e:	53                   	push   %ebx
  80066f:	50                   	push   %eax
  800670:	ff d6                	call   *%esi
  800672:	83 c4 10             	add    $0x10,%esp
  800675:	eb dc                	jmp    800653 <vprintfmt+0x378>
	if (lflag >= 2)
  800677:	83 f9 01             	cmp    $0x1,%ecx
  80067a:	7f 1b                	jg     800697 <vprintfmt+0x3bc>
	else if (lflag)
  80067c:	85 c9                	test   %ecx,%ecx
  80067e:	74 2c                	je     8006ac <vprintfmt+0x3d1>
		return va_arg(*ap, unsigned long);
  800680:	8b 45 14             	mov    0x14(%ebp),%eax
  800683:	8b 10                	mov    (%eax),%edx
  800685:	b9 00 00 00 00       	mov    $0x0,%ecx
  80068a:	8d 40 04             	lea    0x4(%eax),%eax
  80068d:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 16;
  800690:	b8 10 00 00 00       	mov    $0x10,%eax
		return va_arg(*ap, unsigned long);
  800695:	eb 9f                	jmp    800636 <vprintfmt+0x35b>
		return va_arg(*ap, unsigned long long);
  800697:	8b 45 14             	mov    0x14(%ebp),%eax
  80069a:	8b 10                	mov    (%eax),%edx
  80069c:	8b 48 04             	mov    0x4(%eax),%ecx
  80069f:	8d 40 08             	lea    0x8(%eax),%eax
  8006a2:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 16;
  8006a5:	b8 10 00 00 00       	mov    $0x10,%eax
		return va_arg(*ap, unsigned long long);
  8006aa:	eb 8a                	jmp    800636 <vprintfmt+0x35b>
		return va_arg(*ap, unsigned int);
  8006ac:	8b 45 14             	mov    0x14(%ebp),%eax
  8006af:	8b 10                	mov    (%eax),%edx
  8006b1:	b9 00 00 00 00       	mov    $0x0,%ecx
  8006b6:	8d 40 04             	lea    0x4(%eax),%eax
  8006b9:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 16;
  8006bc:	b8 10 00 00 00       	mov    $0x10,%eax
		return va_arg(*ap, unsigned int);
  8006c1:	e9 70 ff ff ff       	jmp    800636 <vprintfmt+0x35b>
			putch(ch, putdat);
  8006c6:	83 ec 08             	sub    $0x8,%esp
  8006c9:	53                   	push   %ebx
  8006ca:	6a 25                	push   $0x25
  8006cc:	ff d6                	call   *%esi
			break;
  8006ce:	83 c4 10             	add    $0x10,%esp
  8006d1:	e9 7a ff ff ff       	jmp    800650 <vprintfmt+0x375>
			putch('%', putdat);
  8006d6:	83 ec 08             	sub    $0x8,%esp
  8006d9:	53                   	push   %ebx
  8006da:	6a 25                	push   $0x25
  8006dc:	ff d6                	call   *%esi
			for (fmt--; fmt[-1] != '%'; fmt--)
  8006de:	83 c4 10             	add    $0x10,%esp
  8006e1:	89 f8                	mov    %edi,%eax
  8006e3:	80 78 ff 25          	cmpb   $0x25,-0x1(%eax)
  8006e7:	74 05                	je     8006ee <vprintfmt+0x413>
  8006e9:	83 e8 01             	sub    $0x1,%eax
  8006ec:	eb f5                	jmp    8006e3 <vprintfmt+0x408>
  8006ee:	89 45 e4             	mov    %eax,-0x1c(%ebp)
  8006f1:	e9 5a ff ff ff       	jmp    800650 <vprintfmt+0x375>
}
  8006f6:	8d 65 f4             	lea    -0xc(%ebp),%esp
  8006f9:	5b                   	pop    %ebx
  8006fa:	5e                   	pop    %esi
  8006fb:	5f                   	pop    %edi
  8006fc:	5d                   	pop    %ebp
  8006fd:	c3                   	ret    

008006fe <vsnprintf>:

int
vsnprintf(char *buf, int n, const char *fmt, va_list ap)
{
  8006fe:	f3 0f 1e fb          	endbr32 
  800702:	55                   	push   %ebp
  800703:	89 e5                	mov    %esp,%ebp
  800705:	83 ec 18             	sub    $0x18,%esp
  800708:	8b 45 08             	mov    0x8(%ebp),%eax
  80070b:	8b 55 0c             	mov    0xc(%ebp),%edx
	struct sprintbuf b = {buf, buf+n-1, 0};
  80070e:	89 45 ec             	mov    %eax,-0x14(%ebp)
  800711:	8d 4c 10 ff          	lea    -0x1(%eax,%edx,1),%ecx
  800715:	89 4d f0             	mov    %ecx,-0x10(%ebp)
  800718:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)

	if (buf == NULL || n < 1)
  80071f:	85 c0                	test   %eax,%eax
  800721:	74 26                	je     800749 <vsnprintf+0x4b>
  800723:	85 d2                	test   %edx,%edx
  800725:	7e 22                	jle    800749 <vsnprintf+0x4b>
		return -E_INVAL;

	// print the string to the buffer
	vprintfmt((void*)sprintputch, &b, fmt, ap);
  800727:	ff 75 14             	pushl  0x14(%ebp)
  80072a:	ff 75 10             	pushl  0x10(%ebp)
  80072d:	8d 45 ec             	lea    -0x14(%ebp),%eax
  800730:	50                   	push   %eax
  800731:	68 99 02 80 00       	push   $0x800299
  800736:	e8 a0 fb ff ff       	call   8002db <vprintfmt>

	// null terminate the buffer
	*b.buf = '\0';
  80073b:	8b 45 ec             	mov    -0x14(%ebp),%eax
  80073e:	c6 00 00             	movb   $0x0,(%eax)

	return b.cnt;
  800741:	8b 45 f4             	mov    -0xc(%ebp),%eax
  800744:	83 c4 10             	add    $0x10,%esp
}
  800747:	c9                   	leave  
  800748:	c3                   	ret    
		return -E_INVAL;
  800749:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  80074e:	eb f7                	jmp    800747 <vsnprintf+0x49>

00800750 <snprintf>:

int
snprintf(char *buf, int n, const char *fmt, ...)
{
  800750:	f3 0f 1e fb          	endbr32 
  800754:	55                   	push   %ebp
  800755:	89 e5                	mov    %esp,%ebp
  800757:	83 ec 08             	sub    $0x8,%esp
	va_list ap;
	int rc;

	va_start(ap, fmt);
  80075a:	8d 45 14             	lea    0x14(%ebp),%eax
	rc = vsnprintf(buf, n, fmt, ap);
  80075d:	50                   	push   %eax
  80075e:	ff 75 10             	pushl  0x10(%ebp)
  800761:	ff 75 0c             	pushl  0xc(%ebp)
  800764:	ff 75 08             	pushl  0x8(%ebp)
  800767:	e8 92 ff ff ff       	call   8006fe <vsnprintf>
	va_end(ap);

	return rc;
}
  80076c:	c9                   	leave  
  80076d:	c3                   	ret    

0080076e <strlen>:
// Primespipe runs 3x faster this way.
#define ASM 1

int
strlen(const char *s)
{
  80076e:	f3 0f 1e fb          	endbr32 
  800772:	55                   	push   %ebp
  800773:	89 e5                	mov    %esp,%ebp
  800775:	8b 55 08             	mov    0x8(%ebp),%edx
	int n;

	for (n = 0; *s != '\0'; s++)
  800778:	b8 00 00 00 00       	mov    $0x0,%eax
  80077d:	80 3c 02 00          	cmpb   $0x0,(%edx,%eax,1)
  800781:	74 05                	je     800788 <strlen+0x1a>
		n++;
  800783:	83 c0 01             	add    $0x1,%eax
  800786:	eb f5                	jmp    80077d <strlen+0xf>
	return n;
}
  800788:	5d                   	pop    %ebp
  800789:	c3                   	ret    

0080078a <strnlen>:

int
strnlen(const char *s, size_t size)
{
  80078a:	f3 0f 1e fb          	endbr32 
  80078e:	55                   	push   %ebp
  80078f:	89 e5                	mov    %esp,%ebp
  800791:	8b 4d 08             	mov    0x8(%ebp),%ecx
  800794:	8b 55 0c             	mov    0xc(%ebp),%edx
	int n;

	for (n = 0; size > 0 && *s != '\0'; s++, size--)
  800797:	b8 00 00 00 00       	mov    $0x0,%eax
  80079c:	39 d0                	cmp    %edx,%eax
  80079e:	74 0d                	je     8007ad <strnlen+0x23>
  8007a0:	80 3c 01 00          	cmpb   $0x0,(%ecx,%eax,1)
  8007a4:	74 05                	je     8007ab <strnlen+0x21>
		n++;
  8007a6:	83 c0 01             	add    $0x1,%eax
  8007a9:	eb f1                	jmp    80079c <strnlen+0x12>
  8007ab:	89 c2                	mov    %eax,%edx
	return n;
}
  8007ad:	89 d0                	mov    %edx,%eax
  8007af:	5d                   	pop    %ebp
  8007b0:	c3                   	ret    

008007b1 <strcpy>:

char *
strcpy(char *dst, const char *src)
{
  8007b1:	f3 0f 1e fb          	endbr32 
  8007b5:	55                   	push   %ebp
  8007b6:	89 e5                	mov    %esp,%ebp
  8007b8:	53                   	push   %ebx
  8007b9:	8b 4d 08             	mov    0x8(%ebp),%ecx
  8007bc:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	char *ret;

	ret = dst;
	while ((*dst++ = *src++) != '\0')
  8007bf:	b8 00 00 00 00       	mov    $0x0,%eax
  8007c4:	0f b6 14 03          	movzbl (%ebx,%eax,1),%edx
  8007c8:	88 14 01             	mov    %dl,(%ecx,%eax,1)
  8007cb:	83 c0 01             	add    $0x1,%eax
  8007ce:	84 d2                	test   %dl,%dl
  8007d0:	75 f2                	jne    8007c4 <strcpy+0x13>
		/* do nothing */;
	return ret;
}
  8007d2:	89 c8                	mov    %ecx,%eax
  8007d4:	5b                   	pop    %ebx
  8007d5:	5d                   	pop    %ebp
  8007d6:	c3                   	ret    

008007d7 <strcat>:

char *
strcat(char *dst, const char *src)
{
  8007d7:	f3 0f 1e fb          	endbr32 
  8007db:	55                   	push   %ebp
  8007dc:	89 e5                	mov    %esp,%ebp
  8007de:	53                   	push   %ebx
  8007df:	83 ec 10             	sub    $0x10,%esp
  8007e2:	8b 5d 08             	mov    0x8(%ebp),%ebx
	int len = strlen(dst);
  8007e5:	53                   	push   %ebx
  8007e6:	e8 83 ff ff ff       	call   80076e <strlen>
  8007eb:	83 c4 08             	add    $0x8,%esp
	strcpy(dst + len, src);
  8007ee:	ff 75 0c             	pushl  0xc(%ebp)
  8007f1:	01 d8                	add    %ebx,%eax
  8007f3:	50                   	push   %eax
  8007f4:	e8 b8 ff ff ff       	call   8007b1 <strcpy>
	return dst;
}
  8007f9:	89 d8                	mov    %ebx,%eax
  8007fb:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  8007fe:	c9                   	leave  
  8007ff:	c3                   	ret    

00800800 <strncpy>:

char *
strncpy(char *dst, const char *src, size_t size) {
  800800:	f3 0f 1e fb          	endbr32 
  800804:	55                   	push   %ebp
  800805:	89 e5                	mov    %esp,%ebp
  800807:	56                   	push   %esi
  800808:	53                   	push   %ebx
  800809:	8b 75 08             	mov    0x8(%ebp),%esi
  80080c:	8b 55 0c             	mov    0xc(%ebp),%edx
  80080f:	89 f3                	mov    %esi,%ebx
  800811:	03 5d 10             	add    0x10(%ebp),%ebx
	size_t i;
	char *ret;

	ret = dst;
	for (i = 0; i < size; i++) {
  800814:	89 f0                	mov    %esi,%eax
  800816:	39 d8                	cmp    %ebx,%eax
  800818:	74 11                	je     80082b <strncpy+0x2b>
		*dst++ = *src;
  80081a:	83 c0 01             	add    $0x1,%eax
  80081d:	0f b6 0a             	movzbl (%edx),%ecx
  800820:	88 48 ff             	mov    %cl,-0x1(%eax)
		// If strlen(src) < size, null-pad 'dst' out to 'size' chars
		if (*src != '\0')
			src++;
  800823:	80 f9 01             	cmp    $0x1,%cl
  800826:	83 da ff             	sbb    $0xffffffff,%edx
  800829:	eb eb                	jmp    800816 <strncpy+0x16>
	}
	return ret;
}
  80082b:	89 f0                	mov    %esi,%eax
  80082d:	5b                   	pop    %ebx
  80082e:	5e                   	pop    %esi
  80082f:	5d                   	pop    %ebp
  800830:	c3                   	ret    

00800831 <strlcpy>:

size_t
strlcpy(char *dst, const char *src, size_t size)
{
  800831:	f3 0f 1e fb          	endbr32 
  800835:	55                   	push   %ebp
  800836:	89 e5                	mov    %esp,%ebp
  800838:	56                   	push   %esi
  800839:	53                   	push   %ebx
  80083a:	8b 75 08             	mov    0x8(%ebp),%esi
  80083d:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800840:	8b 55 10             	mov    0x10(%ebp),%edx
  800843:	89 f0                	mov    %esi,%eax
	char *dst_in;

	dst_in = dst;
	if (size > 0) {
  800845:	85 d2                	test   %edx,%edx
  800847:	74 21                	je     80086a <strlcpy+0x39>
  800849:	8d 44 16 ff          	lea    -0x1(%esi,%edx,1),%eax
  80084d:	89 f2                	mov    %esi,%edx
		while (--size > 0 && *src != '\0')
  80084f:	39 c2                	cmp    %eax,%edx
  800851:	74 14                	je     800867 <strlcpy+0x36>
  800853:	0f b6 19             	movzbl (%ecx),%ebx
  800856:	84 db                	test   %bl,%bl
  800858:	74 0b                	je     800865 <strlcpy+0x34>
			*dst++ = *src++;
  80085a:	83 c1 01             	add    $0x1,%ecx
  80085d:	83 c2 01             	add    $0x1,%edx
  800860:	88 5a ff             	mov    %bl,-0x1(%edx)
  800863:	eb ea                	jmp    80084f <strlcpy+0x1e>
  800865:	89 d0                	mov    %edx,%eax
		*dst = '\0';
  800867:	c6 00 00             	movb   $0x0,(%eax)
	}
	return dst - dst_in;
  80086a:	29 f0                	sub    %esi,%eax
}
  80086c:	5b                   	pop    %ebx
  80086d:	5e                   	pop    %esi
  80086e:	5d                   	pop    %ebp
  80086f:	c3                   	ret    

00800870 <strcmp>:

int
strcmp(const char *p, const char *q)
{
  800870:	f3 0f 1e fb          	endbr32 
  800874:	55                   	push   %ebp
  800875:	89 e5                	mov    %esp,%ebp
  800877:	8b 4d 08             	mov    0x8(%ebp),%ecx
  80087a:	8b 55 0c             	mov    0xc(%ebp),%edx
	while (*p && *p == *q)
  80087d:	0f b6 01             	movzbl (%ecx),%eax
  800880:	84 c0                	test   %al,%al
  800882:	74 0c                	je     800890 <strcmp+0x20>
  800884:	3a 02                	cmp    (%edx),%al
  800886:	75 08                	jne    800890 <strcmp+0x20>
		p++, q++;
  800888:	83 c1 01             	add    $0x1,%ecx
  80088b:	83 c2 01             	add    $0x1,%edx
  80088e:	eb ed                	jmp    80087d <strcmp+0xd>
	return (int) ((unsigned char) *p - (unsigned char) *q);
  800890:	0f b6 c0             	movzbl %al,%eax
  800893:	0f b6 12             	movzbl (%edx),%edx
  800896:	29 d0                	sub    %edx,%eax
}
  800898:	5d                   	pop    %ebp
  800899:	c3                   	ret    

0080089a <strncmp>:

int
strncmp(const char *p, const char *q, size_t n)
{
  80089a:	f3 0f 1e fb          	endbr32 
  80089e:	55                   	push   %ebp
  80089f:	89 e5                	mov    %esp,%ebp
  8008a1:	53                   	push   %ebx
  8008a2:	8b 45 08             	mov    0x8(%ebp),%eax
  8008a5:	8b 55 0c             	mov    0xc(%ebp),%edx
  8008a8:	89 c3                	mov    %eax,%ebx
  8008aa:	03 5d 10             	add    0x10(%ebp),%ebx
	while (n > 0 && *p && *p == *q)
  8008ad:	eb 06                	jmp    8008b5 <strncmp+0x1b>
		n--, p++, q++;
  8008af:	83 c0 01             	add    $0x1,%eax
  8008b2:	83 c2 01             	add    $0x1,%edx
	while (n > 0 && *p && *p == *q)
  8008b5:	39 d8                	cmp    %ebx,%eax
  8008b7:	74 16                	je     8008cf <strncmp+0x35>
  8008b9:	0f b6 08             	movzbl (%eax),%ecx
  8008bc:	84 c9                	test   %cl,%cl
  8008be:	74 04                	je     8008c4 <strncmp+0x2a>
  8008c0:	3a 0a                	cmp    (%edx),%cl
  8008c2:	74 eb                	je     8008af <strncmp+0x15>
	if (n == 0)
		return 0;
	else
		return (int) ((unsigned char) *p - (unsigned char) *q);
  8008c4:	0f b6 00             	movzbl (%eax),%eax
  8008c7:	0f b6 12             	movzbl (%edx),%edx
  8008ca:	29 d0                	sub    %edx,%eax
}
  8008cc:	5b                   	pop    %ebx
  8008cd:	5d                   	pop    %ebp
  8008ce:	c3                   	ret    
		return 0;
  8008cf:	b8 00 00 00 00       	mov    $0x0,%eax
  8008d4:	eb f6                	jmp    8008cc <strncmp+0x32>

008008d6 <strchr>:

// Return a pointer to the first occurrence of 'c' in 's',
// or a null pointer if the string has no 'c'.
char *
strchr(const char *s, char c)
{
  8008d6:	f3 0f 1e fb          	endbr32 
  8008da:	55                   	push   %ebp
  8008db:	89 e5                	mov    %esp,%ebp
  8008dd:	8b 45 08             	mov    0x8(%ebp),%eax
  8008e0:	0f b6 4d 0c          	movzbl 0xc(%ebp),%ecx
	for (; *s; s++)
  8008e4:	0f b6 10             	movzbl (%eax),%edx
  8008e7:	84 d2                	test   %dl,%dl
  8008e9:	74 09                	je     8008f4 <strchr+0x1e>
		if (*s == c)
  8008eb:	38 ca                	cmp    %cl,%dl
  8008ed:	74 0a                	je     8008f9 <strchr+0x23>
	for (; *s; s++)
  8008ef:	83 c0 01             	add    $0x1,%eax
  8008f2:	eb f0                	jmp    8008e4 <strchr+0xe>
			return (char *) s;
	return 0;
  8008f4:	b8 00 00 00 00       	mov    $0x0,%eax
}
  8008f9:	5d                   	pop    %ebp
  8008fa:	c3                   	ret    

008008fb <strfind>:

// Return a pointer to the first occurrence of 'c' in 's',
// or a pointer to the string-ending null character if the string has no 'c'.
char *
strfind(const char *s, char c)
{
  8008fb:	f3 0f 1e fb          	endbr32 
  8008ff:	55                   	push   %ebp
  800900:	89 e5                	mov    %esp,%ebp
  800902:	8b 45 08             	mov    0x8(%ebp),%eax
  800905:	0f b6 4d 0c          	movzbl 0xc(%ebp),%ecx
	for (; *s; s++)
  800909:	0f b6 10             	movzbl (%eax),%edx
		if (*s == c)
  80090c:	38 ca                	cmp    %cl,%dl
  80090e:	74 09                	je     800919 <strfind+0x1e>
  800910:	84 d2                	test   %dl,%dl
  800912:	74 05                	je     800919 <strfind+0x1e>
	for (; *s; s++)
  800914:	83 c0 01             	add    $0x1,%eax
  800917:	eb f0                	jmp    800909 <strfind+0xe>
			break;
	return (char *) s;
}
  800919:	5d                   	pop    %ebp
  80091a:	c3                   	ret    

0080091b <memset>:

#if ASM
void *
memset(void *v, int c, size_t n)
{
  80091b:	f3 0f 1e fb          	endbr32 
  80091f:	55                   	push   %ebp
  800920:	89 e5                	mov    %esp,%ebp
  800922:	57                   	push   %edi
  800923:	56                   	push   %esi
  800924:	53                   	push   %ebx
  800925:	8b 7d 08             	mov    0x8(%ebp),%edi
  800928:	8b 4d 10             	mov    0x10(%ebp),%ecx
	char *p;

	if (n == 0)
  80092b:	85 c9                	test   %ecx,%ecx
  80092d:	74 31                	je     800960 <memset+0x45>
		return v;
	if ((int)v%4 == 0 && n%4 == 0) {
  80092f:	89 f8                	mov    %edi,%eax
  800931:	09 c8                	or     %ecx,%eax
  800933:	a8 03                	test   $0x3,%al
  800935:	75 23                	jne    80095a <memset+0x3f>
		c &= 0xFF;
  800937:	0f b6 55 0c          	movzbl 0xc(%ebp),%edx
		c = (c<<24)|(c<<16)|(c<<8)|c;
  80093b:	89 d3                	mov    %edx,%ebx
  80093d:	c1 e3 08             	shl    $0x8,%ebx
  800940:	89 d0                	mov    %edx,%eax
  800942:	c1 e0 18             	shl    $0x18,%eax
  800945:	89 d6                	mov    %edx,%esi
  800947:	c1 e6 10             	shl    $0x10,%esi
  80094a:	09 f0                	or     %esi,%eax
  80094c:	09 c2                	or     %eax,%edx
  80094e:	09 da                	or     %ebx,%edx
		asm volatile("cld; rep stosl\n"
			:: "D" (v), "a" (c), "c" (n/4)
  800950:	c1 e9 02             	shr    $0x2,%ecx
		asm volatile("cld; rep stosl\n"
  800953:	89 d0                	mov    %edx,%eax
  800955:	fc                   	cld    
  800956:	f3 ab                	rep stos %eax,%es:(%edi)
  800958:	eb 06                	jmp    800960 <memset+0x45>
			: "cc", "memory");
	} else
		asm volatile("cld; rep stosb\n"
  80095a:	8b 45 0c             	mov    0xc(%ebp),%eax
  80095d:	fc                   	cld    
  80095e:	f3 aa                	rep stos %al,%es:(%edi)
			:: "D" (v), "a" (c), "c" (n)
			: "cc", "memory");
	return v;
}
  800960:	89 f8                	mov    %edi,%eax
  800962:	5b                   	pop    %ebx
  800963:	5e                   	pop    %esi
  800964:	5f                   	pop    %edi
  800965:	5d                   	pop    %ebp
  800966:	c3                   	ret    

00800967 <memmove>:

void *
memmove(void *dst, const void *src, size_t n)
{
  800967:	f3 0f 1e fb          	endbr32 
  80096b:	55                   	push   %ebp
  80096c:	89 e5                	mov    %esp,%ebp
  80096e:	57                   	push   %edi
  80096f:	56                   	push   %esi
  800970:	8b 45 08             	mov    0x8(%ebp),%eax
  800973:	8b 75 0c             	mov    0xc(%ebp),%esi
  800976:	8b 4d 10             	mov    0x10(%ebp),%ecx
	const char *s;
	char *d;

	s = src;
	d = dst;
	if (s < d && s + n > d) {
  800979:	39 c6                	cmp    %eax,%esi
  80097b:	73 32                	jae    8009af <memmove+0x48>
  80097d:	8d 14 0e             	lea    (%esi,%ecx,1),%edx
  800980:	39 c2                	cmp    %eax,%edx
  800982:	76 2b                	jbe    8009af <memmove+0x48>
		s += n;
		d += n;
  800984:	8d 3c 08             	lea    (%eax,%ecx,1),%edi
		if ((int)s%4 == 0 && (int)d%4 == 0 && n%4 == 0)
  800987:	89 fe                	mov    %edi,%esi
  800989:	09 ce                	or     %ecx,%esi
  80098b:	09 d6                	or     %edx,%esi
  80098d:	f7 c6 03 00 00 00    	test   $0x3,%esi
  800993:	75 0e                	jne    8009a3 <memmove+0x3c>
			asm volatile("std; rep movsl\n"
				:: "D" (d-4), "S" (s-4), "c" (n/4) : "cc", "memory");
  800995:	83 ef 04             	sub    $0x4,%edi
  800998:	8d 72 fc             	lea    -0x4(%edx),%esi
  80099b:	c1 e9 02             	shr    $0x2,%ecx
			asm volatile("std; rep movsl\n"
  80099e:	fd                   	std    
  80099f:	f3 a5                	rep movsl %ds:(%esi),%es:(%edi)
  8009a1:	eb 09                	jmp    8009ac <memmove+0x45>
		else
			asm volatile("std; rep movsb\n"
				:: "D" (d-1), "S" (s-1), "c" (n) : "cc", "memory");
  8009a3:	83 ef 01             	sub    $0x1,%edi
  8009a6:	8d 72 ff             	lea    -0x1(%edx),%esi
			asm volatile("std; rep movsb\n"
  8009a9:	fd                   	std    
  8009aa:	f3 a4                	rep movsb %ds:(%esi),%es:(%edi)
		// Some versions of GCC rely on DF being clear
		asm volatile("cld" ::: "cc");
  8009ac:	fc                   	cld    
  8009ad:	eb 1a                	jmp    8009c9 <memmove+0x62>
	} else {
		if ((int)s%4 == 0 && (int)d%4 == 0 && n%4 == 0)
  8009af:	89 c2                	mov    %eax,%edx
  8009b1:	09 ca                	or     %ecx,%edx
  8009b3:	09 f2                	or     %esi,%edx
  8009b5:	f6 c2 03             	test   $0x3,%dl
  8009b8:	75 0a                	jne    8009c4 <memmove+0x5d>
			asm volatile("cld; rep movsl\n"
				:: "D" (d), "S" (s), "c" (n/4) : "cc", "memory");
  8009ba:	c1 e9 02             	shr    $0x2,%ecx
			asm volatile("cld; rep movsl\n"
  8009bd:	89 c7                	mov    %eax,%edi
  8009bf:	fc                   	cld    
  8009c0:	f3 a5                	rep movsl %ds:(%esi),%es:(%edi)
  8009c2:	eb 05                	jmp    8009c9 <memmove+0x62>
		else
			asm volatile("cld; rep movsb\n"
  8009c4:	89 c7                	mov    %eax,%edi
  8009c6:	fc                   	cld    
  8009c7:	f3 a4                	rep movsb %ds:(%esi),%es:(%edi)
				:: "D" (d), "S" (s), "c" (n) : "cc", "memory");
	}
	return dst;
}
  8009c9:	5e                   	pop    %esi
  8009ca:	5f                   	pop    %edi
  8009cb:	5d                   	pop    %ebp
  8009cc:	c3                   	ret    

008009cd <memcpy>:
}
#endif

void *
memcpy(void *dst, const void *src, size_t n)
{
  8009cd:	f3 0f 1e fb          	endbr32 
  8009d1:	55                   	push   %ebp
  8009d2:	89 e5                	mov    %esp,%ebp
  8009d4:	83 ec 0c             	sub    $0xc,%esp
	return memmove(dst, src, n);
  8009d7:	ff 75 10             	pushl  0x10(%ebp)
  8009da:	ff 75 0c             	pushl  0xc(%ebp)
  8009dd:	ff 75 08             	pushl  0x8(%ebp)
  8009e0:	e8 82 ff ff ff       	call   800967 <memmove>
}
  8009e5:	c9                   	leave  
  8009e6:	c3                   	ret    

008009e7 <memcmp>:

int
memcmp(const void *v1, const void *v2, size_t n)
{
  8009e7:	f3 0f 1e fb          	endbr32 
  8009eb:	55                   	push   %ebp
  8009ec:	89 e5                	mov    %esp,%ebp
  8009ee:	56                   	push   %esi
  8009ef:	53                   	push   %ebx
  8009f0:	8b 45 08             	mov    0x8(%ebp),%eax
  8009f3:	8b 55 0c             	mov    0xc(%ebp),%edx
  8009f6:	89 c6                	mov    %eax,%esi
  8009f8:	03 75 10             	add    0x10(%ebp),%esi
	const uint8_t *s1 = (const uint8_t *) v1;
	const uint8_t *s2 = (const uint8_t *) v2;

	while (n-- > 0) {
  8009fb:	39 f0                	cmp    %esi,%eax
  8009fd:	74 1c                	je     800a1b <memcmp+0x34>
		if (*s1 != *s2)
  8009ff:	0f b6 08             	movzbl (%eax),%ecx
  800a02:	0f b6 1a             	movzbl (%edx),%ebx
  800a05:	38 d9                	cmp    %bl,%cl
  800a07:	75 08                	jne    800a11 <memcmp+0x2a>
			return (int) *s1 - (int) *s2;
		s1++, s2++;
  800a09:	83 c0 01             	add    $0x1,%eax
  800a0c:	83 c2 01             	add    $0x1,%edx
  800a0f:	eb ea                	jmp    8009fb <memcmp+0x14>
			return (int) *s1 - (int) *s2;
  800a11:	0f b6 c1             	movzbl %cl,%eax
  800a14:	0f b6 db             	movzbl %bl,%ebx
  800a17:	29 d8                	sub    %ebx,%eax
  800a19:	eb 05                	jmp    800a20 <memcmp+0x39>
	}

	return 0;
  800a1b:	b8 00 00 00 00       	mov    $0x0,%eax
}
  800a20:	5b                   	pop    %ebx
  800a21:	5e                   	pop    %esi
  800a22:	5d                   	pop    %ebp
  800a23:	c3                   	ret    

00800a24 <memfind>:

void *
memfind(const void *s, int c, size_t n)
{
  800a24:	f3 0f 1e fb          	endbr32 
  800a28:	55                   	push   %ebp
  800a29:	89 e5                	mov    %esp,%ebp
  800a2b:	8b 45 08             	mov    0x8(%ebp),%eax
  800a2e:	8b 4d 0c             	mov    0xc(%ebp),%ecx
	const void *ends = (const char *) s + n;
  800a31:	89 c2                	mov    %eax,%edx
  800a33:	03 55 10             	add    0x10(%ebp),%edx
	for (; s < ends; s++)
  800a36:	39 d0                	cmp    %edx,%eax
  800a38:	73 09                	jae    800a43 <memfind+0x1f>
		if (*(const unsigned char *) s == (unsigned char) c)
  800a3a:	38 08                	cmp    %cl,(%eax)
  800a3c:	74 05                	je     800a43 <memfind+0x1f>
	for (; s < ends; s++)
  800a3e:	83 c0 01             	add    $0x1,%eax
  800a41:	eb f3                	jmp    800a36 <memfind+0x12>
			break;
	return (void *) s;
}
  800a43:	5d                   	pop    %ebp
  800a44:	c3                   	ret    

00800a45 <strtol>:

long
strtol(const char *s, char **endptr, int base)
{
  800a45:	f3 0f 1e fb          	endbr32 
  800a49:	55                   	push   %ebp
  800a4a:	89 e5                	mov    %esp,%ebp
  800a4c:	57                   	push   %edi
  800a4d:	56                   	push   %esi
  800a4e:	53                   	push   %ebx
  800a4f:	8b 4d 08             	mov    0x8(%ebp),%ecx
  800a52:	8b 5d 10             	mov    0x10(%ebp),%ebx
	int neg = 0;
	long val = 0;

	// gobble initial whitespace
	while (*s == ' ' || *s == '\t')
  800a55:	eb 03                	jmp    800a5a <strtol+0x15>
		s++;
  800a57:	83 c1 01             	add    $0x1,%ecx
	while (*s == ' ' || *s == '\t')
  800a5a:	0f b6 01             	movzbl (%ecx),%eax
  800a5d:	3c 20                	cmp    $0x20,%al
  800a5f:	74 f6                	je     800a57 <strtol+0x12>
  800a61:	3c 09                	cmp    $0x9,%al
  800a63:	74 f2                	je     800a57 <strtol+0x12>

	// plus/minus sign
	if (*s == '+')
  800a65:	3c 2b                	cmp    $0x2b,%al
  800a67:	74 2a                	je     800a93 <strtol+0x4e>
	int neg = 0;
  800a69:	bf 00 00 00 00       	mov    $0x0,%edi
		s++;
	else if (*s == '-')
  800a6e:	3c 2d                	cmp    $0x2d,%al
  800a70:	74 2b                	je     800a9d <strtol+0x58>
		s++, neg = 1;

	// hex or octal base prefix
	if ((base == 0 || base == 16) && (s[0] == '0' && s[1] == 'x'))
  800a72:	f7 c3 ef ff ff ff    	test   $0xffffffef,%ebx
  800a78:	75 0f                	jne    800a89 <strtol+0x44>
  800a7a:	80 39 30             	cmpb   $0x30,(%ecx)
  800a7d:	74 28                	je     800aa7 <strtol+0x62>
		s += 2, base = 16;
	else if (base == 0 && s[0] == '0')
		s++, base = 8;
	else if (base == 0)
		base = 10;
  800a7f:	85 db                	test   %ebx,%ebx
  800a81:	b8 0a 00 00 00       	mov    $0xa,%eax
  800a86:	0f 44 d8             	cmove  %eax,%ebx
  800a89:	b8 00 00 00 00       	mov    $0x0,%eax
  800a8e:	89 5d 10             	mov    %ebx,0x10(%ebp)
  800a91:	eb 46                	jmp    800ad9 <strtol+0x94>
		s++;
  800a93:	83 c1 01             	add    $0x1,%ecx
	int neg = 0;
  800a96:	bf 00 00 00 00       	mov    $0x0,%edi
  800a9b:	eb d5                	jmp    800a72 <strtol+0x2d>
		s++, neg = 1;
  800a9d:	83 c1 01             	add    $0x1,%ecx
  800aa0:	bf 01 00 00 00       	mov    $0x1,%edi
  800aa5:	eb cb                	jmp    800a72 <strtol+0x2d>
	if ((base == 0 || base == 16) && (s[0] == '0' && s[1] == 'x'))
  800aa7:	80 79 01 78          	cmpb   $0x78,0x1(%ecx)
  800aab:	74 0e                	je     800abb <strtol+0x76>
	else if (base == 0 && s[0] == '0')
  800aad:	85 db                	test   %ebx,%ebx
  800aaf:	75 d8                	jne    800a89 <strtol+0x44>
		s++, base = 8;
  800ab1:	83 c1 01             	add    $0x1,%ecx
  800ab4:	bb 08 00 00 00       	mov    $0x8,%ebx
  800ab9:	eb ce                	jmp    800a89 <strtol+0x44>
		s += 2, base = 16;
  800abb:	83 c1 02             	add    $0x2,%ecx
  800abe:	bb 10 00 00 00       	mov    $0x10,%ebx
  800ac3:	eb c4                	jmp    800a89 <strtol+0x44>
	// digits
	while (1) {
		int dig;

		if (*s >= '0' && *s <= '9')
			dig = *s - '0';
  800ac5:	0f be d2             	movsbl %dl,%edx
  800ac8:	83 ea 30             	sub    $0x30,%edx
			dig = *s - 'a' + 10;
		else if (*s >= 'A' && *s <= 'Z')
			dig = *s - 'A' + 10;
		else
			break;
		if (dig >= base)
  800acb:	3b 55 10             	cmp    0x10(%ebp),%edx
  800ace:	7d 3a                	jge    800b0a <strtol+0xc5>
			break;
		s++, val = (val * base) + dig;
  800ad0:	83 c1 01             	add    $0x1,%ecx
  800ad3:	0f af 45 10          	imul   0x10(%ebp),%eax
  800ad7:	01 d0                	add    %edx,%eax
		if (*s >= '0' && *s <= '9')
  800ad9:	0f b6 11             	movzbl (%ecx),%edx
  800adc:	8d 72 d0             	lea    -0x30(%edx),%esi
  800adf:	89 f3                	mov    %esi,%ebx
  800ae1:	80 fb 09             	cmp    $0x9,%bl
  800ae4:	76 df                	jbe    800ac5 <strtol+0x80>
		else if (*s >= 'a' && *s <= 'z')
  800ae6:	8d 72 9f             	lea    -0x61(%edx),%esi
  800ae9:	89 f3                	mov    %esi,%ebx
  800aeb:	80 fb 19             	cmp    $0x19,%bl
  800aee:	77 08                	ja     800af8 <strtol+0xb3>
			dig = *s - 'a' + 10;
  800af0:	0f be d2             	movsbl %dl,%edx
  800af3:	83 ea 57             	sub    $0x57,%edx
  800af6:	eb d3                	jmp    800acb <strtol+0x86>
		else if (*s >= 'A' && *s <= 'Z')
  800af8:	8d 72 bf             	lea    -0x41(%edx),%esi
  800afb:	89 f3                	mov    %esi,%ebx
  800afd:	80 fb 19             	cmp    $0x19,%bl
  800b00:	77 08                	ja     800b0a <strtol+0xc5>
			dig = *s - 'A' + 10;
  800b02:	0f be d2             	movsbl %dl,%edx
  800b05:	83 ea 37             	sub    $0x37,%edx
  800b08:	eb c1                	jmp    800acb <strtol+0x86>
		// we don't properly detect overflow!
	}

	if (endptr)
  800b0a:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
  800b0e:	74 05                	je     800b15 <strtol+0xd0>
		*endptr = (char *) s;
  800b10:	8b 75 0c             	mov    0xc(%ebp),%esi
  800b13:	89 0e                	mov    %ecx,(%esi)
	return (neg ? -val : val);
  800b15:	89 c2                	mov    %eax,%edx
  800b17:	f7 da                	neg    %edx
  800b19:	85 ff                	test   %edi,%edi
  800b1b:	0f 45 c2             	cmovne %edx,%eax
}
  800b1e:	5b                   	pop    %ebx
  800b1f:	5e                   	pop    %esi
  800b20:	5f                   	pop    %edi
  800b21:	5d                   	pop    %ebp
  800b22:	c3                   	ret    

00800b23 <sys_cputs>:
	return ret;
}

void
sys_cputs(const char *s, size_t len)
{
  800b23:	f3 0f 1e fb          	endbr32 
  800b27:	55                   	push   %ebp
  800b28:	89 e5                	mov    %esp,%ebp
  800b2a:	57                   	push   %edi
  800b2b:	56                   	push   %esi
  800b2c:	53                   	push   %ebx
	asm volatile("int %1\n"
  800b2d:	b8 00 00 00 00       	mov    $0x0,%eax
  800b32:	8b 55 08             	mov    0x8(%ebp),%edx
  800b35:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800b38:	89 c3                	mov    %eax,%ebx
  800b3a:	89 c7                	mov    %eax,%edi
  800b3c:	89 c6                	mov    %eax,%esi
  800b3e:	cd 30                	int    $0x30
	syscall(SYS_cputs, 0, (uint32_t)s, len, 0, 0, 0);
}
  800b40:	5b                   	pop    %ebx
  800b41:	5e                   	pop    %esi
  800b42:	5f                   	pop    %edi
  800b43:	5d                   	pop    %ebp
  800b44:	c3                   	ret    

00800b45 <sys_cgetc>:

int
sys_cgetc(void)
{
  800b45:	f3 0f 1e fb          	endbr32 
  800b49:	55                   	push   %ebp
  800b4a:	89 e5                	mov    %esp,%ebp
  800b4c:	57                   	push   %edi
  800b4d:	56                   	push   %esi
  800b4e:	53                   	push   %ebx
	asm volatile("int %1\n"
  800b4f:	ba 00 00 00 00       	mov    $0x0,%edx
  800b54:	b8 01 00 00 00       	mov    $0x1,%eax
  800b59:	89 d1                	mov    %edx,%ecx
  800b5b:	89 d3                	mov    %edx,%ebx
  800b5d:	89 d7                	mov    %edx,%edi
  800b5f:	89 d6                	mov    %edx,%esi
  800b61:	cd 30                	int    $0x30
	return syscall(SYS_cgetc, 0, 0, 0, 0, 0, 0);
}
  800b63:	5b                   	pop    %ebx
  800b64:	5e                   	pop    %esi
  800b65:	5f                   	pop    %edi
  800b66:	5d                   	pop    %ebp
  800b67:	c3                   	ret    

00800b68 <sys_env_destroy>:

int
sys_env_destroy(envid_t envid)
{
  800b68:	f3 0f 1e fb          	endbr32 
  800b6c:	55                   	push   %ebp
  800b6d:	89 e5                	mov    %esp,%ebp
  800b6f:	57                   	push   %edi
  800b70:	56                   	push   %esi
  800b71:	53                   	push   %ebx
  800b72:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800b75:	b9 00 00 00 00       	mov    $0x0,%ecx
  800b7a:	8b 55 08             	mov    0x8(%ebp),%edx
  800b7d:	b8 03 00 00 00       	mov    $0x3,%eax
  800b82:	89 cb                	mov    %ecx,%ebx
  800b84:	89 cf                	mov    %ecx,%edi
  800b86:	89 ce                	mov    %ecx,%esi
  800b88:	cd 30                	int    $0x30
	if(check && ret > 0)
  800b8a:	85 c0                	test   %eax,%eax
  800b8c:	7f 08                	jg     800b96 <sys_env_destroy+0x2e>
	return syscall(SYS_env_destroy, 1, envid, 0, 0, 0, 0);
}
  800b8e:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800b91:	5b                   	pop    %ebx
  800b92:	5e                   	pop    %esi
  800b93:	5f                   	pop    %edi
  800b94:	5d                   	pop    %ebp
  800b95:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800b96:	83 ec 0c             	sub    $0xc,%esp
  800b99:	50                   	push   %eax
  800b9a:	6a 03                	push   $0x3
  800b9c:	68 9f 28 80 00       	push   $0x80289f
  800ba1:	6a 23                	push   $0x23
  800ba3:	68 bc 28 80 00       	push   $0x8028bc
  800ba8:	e8 44 f5 ff ff       	call   8000f1 <_panic>

00800bad <sys_getenvid>:

envid_t
sys_getenvid(void)
{
  800bad:	f3 0f 1e fb          	endbr32 
  800bb1:	55                   	push   %ebp
  800bb2:	89 e5                	mov    %esp,%ebp
  800bb4:	57                   	push   %edi
  800bb5:	56                   	push   %esi
  800bb6:	53                   	push   %ebx
	asm volatile("int %1\n"
  800bb7:	ba 00 00 00 00       	mov    $0x0,%edx
  800bbc:	b8 02 00 00 00       	mov    $0x2,%eax
  800bc1:	89 d1                	mov    %edx,%ecx
  800bc3:	89 d3                	mov    %edx,%ebx
  800bc5:	89 d7                	mov    %edx,%edi
  800bc7:	89 d6                	mov    %edx,%esi
  800bc9:	cd 30                	int    $0x30
	 return syscall(SYS_getenvid, 0, 0, 0, 0, 0, 0);
}
  800bcb:	5b                   	pop    %ebx
  800bcc:	5e                   	pop    %esi
  800bcd:	5f                   	pop    %edi
  800bce:	5d                   	pop    %ebp
  800bcf:	c3                   	ret    

00800bd0 <sys_yield>:

void
sys_yield(void)
{
  800bd0:	f3 0f 1e fb          	endbr32 
  800bd4:	55                   	push   %ebp
  800bd5:	89 e5                	mov    %esp,%ebp
  800bd7:	57                   	push   %edi
  800bd8:	56                   	push   %esi
  800bd9:	53                   	push   %ebx
	asm volatile("int %1\n"
  800bda:	ba 00 00 00 00       	mov    $0x0,%edx
  800bdf:	b8 0b 00 00 00       	mov    $0xb,%eax
  800be4:	89 d1                	mov    %edx,%ecx
  800be6:	89 d3                	mov    %edx,%ebx
  800be8:	89 d7                	mov    %edx,%edi
  800bea:	89 d6                	mov    %edx,%esi
  800bec:	cd 30                	int    $0x30
	syscall(SYS_yield, 0, 0, 0, 0, 0, 0);
}
  800bee:	5b                   	pop    %ebx
  800bef:	5e                   	pop    %esi
  800bf0:	5f                   	pop    %edi
  800bf1:	5d                   	pop    %ebp
  800bf2:	c3                   	ret    

00800bf3 <sys_page_alloc>:

int
sys_page_alloc(envid_t envid, void *va, int perm)
{
  800bf3:	f3 0f 1e fb          	endbr32 
  800bf7:	55                   	push   %ebp
  800bf8:	89 e5                	mov    %esp,%ebp
  800bfa:	57                   	push   %edi
  800bfb:	56                   	push   %esi
  800bfc:	53                   	push   %ebx
  800bfd:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800c00:	be 00 00 00 00       	mov    $0x0,%esi
  800c05:	8b 55 08             	mov    0x8(%ebp),%edx
  800c08:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800c0b:	b8 04 00 00 00       	mov    $0x4,%eax
  800c10:	8b 5d 10             	mov    0x10(%ebp),%ebx
  800c13:	89 f7                	mov    %esi,%edi
  800c15:	cd 30                	int    $0x30
	if(check && ret > 0)
  800c17:	85 c0                	test   %eax,%eax
  800c19:	7f 08                	jg     800c23 <sys_page_alloc+0x30>
	return syscall(SYS_page_alloc, 1, envid, (uint32_t) va, perm, 0, 0);
}
  800c1b:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800c1e:	5b                   	pop    %ebx
  800c1f:	5e                   	pop    %esi
  800c20:	5f                   	pop    %edi
  800c21:	5d                   	pop    %ebp
  800c22:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800c23:	83 ec 0c             	sub    $0xc,%esp
  800c26:	50                   	push   %eax
  800c27:	6a 04                	push   $0x4
  800c29:	68 9f 28 80 00       	push   $0x80289f
  800c2e:	6a 23                	push   $0x23
  800c30:	68 bc 28 80 00       	push   $0x8028bc
  800c35:	e8 b7 f4 ff ff       	call   8000f1 <_panic>

00800c3a <sys_page_map>:

int
sys_page_map(envid_t srcenv, void *srcva, envid_t dstenv, void *dstva, int perm)
{
  800c3a:	f3 0f 1e fb          	endbr32 
  800c3e:	55                   	push   %ebp
  800c3f:	89 e5                	mov    %esp,%ebp
  800c41:	57                   	push   %edi
  800c42:	56                   	push   %esi
  800c43:	53                   	push   %ebx
  800c44:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800c47:	8b 55 08             	mov    0x8(%ebp),%edx
  800c4a:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800c4d:	b8 05 00 00 00       	mov    $0x5,%eax
  800c52:	8b 5d 10             	mov    0x10(%ebp),%ebx
  800c55:	8b 7d 14             	mov    0x14(%ebp),%edi
  800c58:	8b 75 18             	mov    0x18(%ebp),%esi
  800c5b:	cd 30                	int    $0x30
	if(check && ret > 0)
  800c5d:	85 c0                	test   %eax,%eax
  800c5f:	7f 08                	jg     800c69 <sys_page_map+0x2f>
	return syscall(SYS_page_map, 1, srcenv, (uint32_t) srcva, dstenv, (uint32_t) dstva, perm);
}
  800c61:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800c64:	5b                   	pop    %ebx
  800c65:	5e                   	pop    %esi
  800c66:	5f                   	pop    %edi
  800c67:	5d                   	pop    %ebp
  800c68:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800c69:	83 ec 0c             	sub    $0xc,%esp
  800c6c:	50                   	push   %eax
  800c6d:	6a 05                	push   $0x5
  800c6f:	68 9f 28 80 00       	push   $0x80289f
  800c74:	6a 23                	push   $0x23
  800c76:	68 bc 28 80 00       	push   $0x8028bc
  800c7b:	e8 71 f4 ff ff       	call   8000f1 <_panic>

00800c80 <sys_page_unmap>:

int
sys_page_unmap(envid_t envid, void *va)
{
  800c80:	f3 0f 1e fb          	endbr32 
  800c84:	55                   	push   %ebp
  800c85:	89 e5                	mov    %esp,%ebp
  800c87:	57                   	push   %edi
  800c88:	56                   	push   %esi
  800c89:	53                   	push   %ebx
  800c8a:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800c8d:	bb 00 00 00 00       	mov    $0x0,%ebx
  800c92:	8b 55 08             	mov    0x8(%ebp),%edx
  800c95:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800c98:	b8 06 00 00 00       	mov    $0x6,%eax
  800c9d:	89 df                	mov    %ebx,%edi
  800c9f:	89 de                	mov    %ebx,%esi
  800ca1:	cd 30                	int    $0x30
	if(check && ret > 0)
  800ca3:	85 c0                	test   %eax,%eax
  800ca5:	7f 08                	jg     800caf <sys_page_unmap+0x2f>
	return syscall(SYS_page_unmap, 1, envid, (uint32_t) va, 0, 0, 0);
}
  800ca7:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800caa:	5b                   	pop    %ebx
  800cab:	5e                   	pop    %esi
  800cac:	5f                   	pop    %edi
  800cad:	5d                   	pop    %ebp
  800cae:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800caf:	83 ec 0c             	sub    $0xc,%esp
  800cb2:	50                   	push   %eax
  800cb3:	6a 06                	push   $0x6
  800cb5:	68 9f 28 80 00       	push   $0x80289f
  800cba:	6a 23                	push   $0x23
  800cbc:	68 bc 28 80 00       	push   $0x8028bc
  800cc1:	e8 2b f4 ff ff       	call   8000f1 <_panic>

00800cc6 <sys_env_set_status>:

// sys_exofork is inlined in lib.h

int
sys_env_set_status(envid_t envid, int status)
{
  800cc6:	f3 0f 1e fb          	endbr32 
  800cca:	55                   	push   %ebp
  800ccb:	89 e5                	mov    %esp,%ebp
  800ccd:	57                   	push   %edi
  800cce:	56                   	push   %esi
  800ccf:	53                   	push   %ebx
  800cd0:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800cd3:	bb 00 00 00 00       	mov    $0x0,%ebx
  800cd8:	8b 55 08             	mov    0x8(%ebp),%edx
  800cdb:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800cde:	b8 08 00 00 00       	mov    $0x8,%eax
  800ce3:	89 df                	mov    %ebx,%edi
  800ce5:	89 de                	mov    %ebx,%esi
  800ce7:	cd 30                	int    $0x30
	if(check && ret > 0)
  800ce9:	85 c0                	test   %eax,%eax
  800ceb:	7f 08                	jg     800cf5 <sys_env_set_status+0x2f>
	return syscall(SYS_env_set_status, 1, envid, status, 0, 0, 0);
}
  800ced:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800cf0:	5b                   	pop    %ebx
  800cf1:	5e                   	pop    %esi
  800cf2:	5f                   	pop    %edi
  800cf3:	5d                   	pop    %ebp
  800cf4:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800cf5:	83 ec 0c             	sub    $0xc,%esp
  800cf8:	50                   	push   %eax
  800cf9:	6a 08                	push   $0x8
  800cfb:	68 9f 28 80 00       	push   $0x80289f
  800d00:	6a 23                	push   $0x23
  800d02:	68 bc 28 80 00       	push   $0x8028bc
  800d07:	e8 e5 f3 ff ff       	call   8000f1 <_panic>

00800d0c <sys_env_set_trapframe>:

int
sys_env_set_trapframe(envid_t envid, struct Trapframe *tf)
{
  800d0c:	f3 0f 1e fb          	endbr32 
  800d10:	55                   	push   %ebp
  800d11:	89 e5                	mov    %esp,%ebp
  800d13:	57                   	push   %edi
  800d14:	56                   	push   %esi
  800d15:	53                   	push   %ebx
  800d16:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800d19:	bb 00 00 00 00       	mov    $0x0,%ebx
  800d1e:	8b 55 08             	mov    0x8(%ebp),%edx
  800d21:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800d24:	b8 09 00 00 00       	mov    $0x9,%eax
  800d29:	89 df                	mov    %ebx,%edi
  800d2b:	89 de                	mov    %ebx,%esi
  800d2d:	cd 30                	int    $0x30
	if(check && ret > 0)
  800d2f:	85 c0                	test   %eax,%eax
  800d31:	7f 08                	jg     800d3b <sys_env_set_trapframe+0x2f>
	return syscall(SYS_env_set_trapframe, 1, envid, (uint32_t) tf, 0, 0, 0);
}
  800d33:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800d36:	5b                   	pop    %ebx
  800d37:	5e                   	pop    %esi
  800d38:	5f                   	pop    %edi
  800d39:	5d                   	pop    %ebp
  800d3a:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800d3b:	83 ec 0c             	sub    $0xc,%esp
  800d3e:	50                   	push   %eax
  800d3f:	6a 09                	push   $0x9
  800d41:	68 9f 28 80 00       	push   $0x80289f
  800d46:	6a 23                	push   $0x23
  800d48:	68 bc 28 80 00       	push   $0x8028bc
  800d4d:	e8 9f f3 ff ff       	call   8000f1 <_panic>

00800d52 <sys_env_set_pgfault_upcall>:

int
sys_env_set_pgfault_upcall(envid_t envid, void *upcall)
{
  800d52:	f3 0f 1e fb          	endbr32 
  800d56:	55                   	push   %ebp
  800d57:	89 e5                	mov    %esp,%ebp
  800d59:	57                   	push   %edi
  800d5a:	56                   	push   %esi
  800d5b:	53                   	push   %ebx
  800d5c:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800d5f:	bb 00 00 00 00       	mov    $0x0,%ebx
  800d64:	8b 55 08             	mov    0x8(%ebp),%edx
  800d67:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800d6a:	b8 0a 00 00 00       	mov    $0xa,%eax
  800d6f:	89 df                	mov    %ebx,%edi
  800d71:	89 de                	mov    %ebx,%esi
  800d73:	cd 30                	int    $0x30
	if(check && ret > 0)
  800d75:	85 c0                	test   %eax,%eax
  800d77:	7f 08                	jg     800d81 <sys_env_set_pgfault_upcall+0x2f>
	return syscall(SYS_env_set_pgfault_upcall, 1, envid, (uint32_t) upcall, 0, 0, 0);
}
  800d79:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800d7c:	5b                   	pop    %ebx
  800d7d:	5e                   	pop    %esi
  800d7e:	5f                   	pop    %edi
  800d7f:	5d                   	pop    %ebp
  800d80:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800d81:	83 ec 0c             	sub    $0xc,%esp
  800d84:	50                   	push   %eax
  800d85:	6a 0a                	push   $0xa
  800d87:	68 9f 28 80 00       	push   $0x80289f
  800d8c:	6a 23                	push   $0x23
  800d8e:	68 bc 28 80 00       	push   $0x8028bc
  800d93:	e8 59 f3 ff ff       	call   8000f1 <_panic>

00800d98 <sys_ipc_try_send>:

int
sys_ipc_try_send(envid_t envid, uint32_t value, void *srcva, int perm)
{
  800d98:	f3 0f 1e fb          	endbr32 
  800d9c:	55                   	push   %ebp
  800d9d:	89 e5                	mov    %esp,%ebp
  800d9f:	57                   	push   %edi
  800da0:	56                   	push   %esi
  800da1:	53                   	push   %ebx
	asm volatile("int %1\n"
  800da2:	8b 55 08             	mov    0x8(%ebp),%edx
  800da5:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800da8:	b8 0c 00 00 00       	mov    $0xc,%eax
  800dad:	be 00 00 00 00       	mov    $0x0,%esi
  800db2:	8b 5d 10             	mov    0x10(%ebp),%ebx
  800db5:	8b 7d 14             	mov    0x14(%ebp),%edi
  800db8:	cd 30                	int    $0x30
	return syscall(SYS_ipc_try_send, 0, envid, value, (uint32_t) srcva, perm, 0);
}
  800dba:	5b                   	pop    %ebx
  800dbb:	5e                   	pop    %esi
  800dbc:	5f                   	pop    %edi
  800dbd:	5d                   	pop    %ebp
  800dbe:	c3                   	ret    

00800dbf <sys_ipc_recv>:

int
sys_ipc_recv(void *dstva)
{
  800dbf:	f3 0f 1e fb          	endbr32 
  800dc3:	55                   	push   %ebp
  800dc4:	89 e5                	mov    %esp,%ebp
  800dc6:	57                   	push   %edi
  800dc7:	56                   	push   %esi
  800dc8:	53                   	push   %ebx
  800dc9:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800dcc:	b9 00 00 00 00       	mov    $0x0,%ecx
  800dd1:	8b 55 08             	mov    0x8(%ebp),%edx
  800dd4:	b8 0d 00 00 00       	mov    $0xd,%eax
  800dd9:	89 cb                	mov    %ecx,%ebx
  800ddb:	89 cf                	mov    %ecx,%edi
  800ddd:	89 ce                	mov    %ecx,%esi
  800ddf:	cd 30                	int    $0x30
	if(check && ret > 0)
  800de1:	85 c0                	test   %eax,%eax
  800de3:	7f 08                	jg     800ded <sys_ipc_recv+0x2e>
	return syscall(SYS_ipc_recv, 1, (uint32_t)dstva, 0, 0, 0, 0);
}
  800de5:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800de8:	5b                   	pop    %ebx
  800de9:	5e                   	pop    %esi
  800dea:	5f                   	pop    %edi
  800deb:	5d                   	pop    %ebp
  800dec:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800ded:	83 ec 0c             	sub    $0xc,%esp
  800df0:	50                   	push   %eax
  800df1:	6a 0d                	push   $0xd
  800df3:	68 9f 28 80 00       	push   $0x80289f
  800df8:	6a 23                	push   $0x23
  800dfa:	68 bc 28 80 00       	push   $0x8028bc
  800dff:	e8 ed f2 ff ff       	call   8000f1 <_panic>

00800e04 <fd2num>:
// File descriptor manipulators
// --------------------------------------------------------------

int
fd2num(struct Fd *fd)
{
  800e04:	f3 0f 1e fb          	endbr32 
  800e08:	55                   	push   %ebp
  800e09:	89 e5                	mov    %esp,%ebp
	return ((uintptr_t) fd - FDTABLE) / PGSIZE;
  800e0b:	8b 45 08             	mov    0x8(%ebp),%eax
  800e0e:	05 00 00 00 30       	add    $0x30000000,%eax
  800e13:	c1 e8 0c             	shr    $0xc,%eax
}
  800e16:	5d                   	pop    %ebp
  800e17:	c3                   	ret    

00800e18 <fd2data>:

char*
fd2data(struct Fd *fd)
{
  800e18:	f3 0f 1e fb          	endbr32 
  800e1c:	55                   	push   %ebp
  800e1d:	89 e5                	mov    %esp,%ebp
	return ((uintptr_t) fd - FDTABLE) / PGSIZE;
  800e1f:	8b 45 08             	mov    0x8(%ebp),%eax
  800e22:	05 00 00 00 30       	add    $0x30000000,%eax
	return INDEX2DATA(fd2num(fd));
  800e27:	25 00 f0 ff ff       	and    $0xfffff000,%eax
  800e2c:	2d 00 00 fe 2f       	sub    $0x2ffe0000,%eax
}
  800e31:	5d                   	pop    %ebp
  800e32:	c3                   	ret    

00800e33 <fd_alloc>:
// Returns 0 on success, < 0 on error.  Errors are:
//	-E_MAX_FD: no more file descriptors
// On error, *fd_store is set to 0.
int
fd_alloc(struct Fd **fd_store)
{
  800e33:	f3 0f 1e fb          	endbr32 
  800e37:	55                   	push   %ebp
  800e38:	89 e5                	mov    %esp,%ebp
  800e3a:	b8 00 00 00 d0       	mov    $0xd0000000,%eax
	int i;
	struct Fd *fd;

	for (i = 0; i < MAXFD; i++) {
		fd = INDEX2FD(i);
		if ((uvpd[PDX(fd)] & PTE_P) == 0 || (uvpt[PGNUM(fd)] & PTE_P) == 0) {
  800e3f:	89 c2                	mov    %eax,%edx
  800e41:	c1 ea 16             	shr    $0x16,%edx
  800e44:	8b 14 95 00 d0 7b ef 	mov    -0x10843000(,%edx,4),%edx
  800e4b:	f6 c2 01             	test   $0x1,%dl
  800e4e:	74 2d                	je     800e7d <fd_alloc+0x4a>
  800e50:	89 c2                	mov    %eax,%edx
  800e52:	c1 ea 0c             	shr    $0xc,%edx
  800e55:	8b 14 95 00 00 40 ef 	mov    -0x10c00000(,%edx,4),%edx
  800e5c:	f6 c2 01             	test   $0x1,%dl
  800e5f:	74 1c                	je     800e7d <fd_alloc+0x4a>
  800e61:	05 00 10 00 00       	add    $0x1000,%eax
	for (i = 0; i < MAXFD; i++) {
  800e66:	3d 00 00 02 d0       	cmp    $0xd0020000,%eax
  800e6b:	75 d2                	jne    800e3f <fd_alloc+0xc>
			*fd_store = fd;
			return 0;
		}
	}
	*fd_store = 0;
  800e6d:	8b 45 08             	mov    0x8(%ebp),%eax
  800e70:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
	return -E_MAX_OPEN;
  800e76:	b8 f6 ff ff ff       	mov    $0xfffffff6,%eax
  800e7b:	eb 0a                	jmp    800e87 <fd_alloc+0x54>
			*fd_store = fd;
  800e7d:	8b 4d 08             	mov    0x8(%ebp),%ecx
  800e80:	89 01                	mov    %eax,(%ecx)
			return 0;
  800e82:	b8 00 00 00 00       	mov    $0x0,%eax
}
  800e87:	5d                   	pop    %ebp
  800e88:	c3                   	ret    

00800e89 <fd_lookup>:
// Returns 0 on success (the page is in range and mapped), < 0 on error.
// Errors are:
//	-E_INVAL: fdnum was either not in range or not mapped.
int
fd_lookup(int fdnum, struct Fd **fd_store)
{
  800e89:	f3 0f 1e fb          	endbr32 
  800e8d:	55                   	push   %ebp
  800e8e:	89 e5                	mov    %esp,%ebp
  800e90:	8b 45 08             	mov    0x8(%ebp),%eax
	struct Fd *fd;

	if (fdnum < 0 || fdnum >= MAXFD) {
  800e93:	83 f8 1f             	cmp    $0x1f,%eax
  800e96:	77 30                	ja     800ec8 <fd_lookup+0x3f>
		if (debug)
			cprintf("[%08x] bad fd %d\n", thisenv->env_id, fdnum);
		return -E_INVAL;
	}
	fd = INDEX2FD(fdnum);
  800e98:	c1 e0 0c             	shl    $0xc,%eax
  800e9b:	2d 00 00 00 30       	sub    $0x30000000,%eax
	if (!(uvpd[PDX(fd)] & PTE_P) || !(uvpt[PGNUM(fd)] & PTE_P)) {
  800ea0:	8b 15 00 dd 7b ef    	mov    0xef7bdd00,%edx
  800ea6:	f6 c2 01             	test   $0x1,%dl
  800ea9:	74 24                	je     800ecf <fd_lookup+0x46>
  800eab:	89 c2                	mov    %eax,%edx
  800ead:	c1 ea 0c             	shr    $0xc,%edx
  800eb0:	8b 14 95 00 00 40 ef 	mov    -0x10c00000(,%edx,4),%edx
  800eb7:	f6 c2 01             	test   $0x1,%dl
  800eba:	74 1a                	je     800ed6 <fd_lookup+0x4d>
		if (debug)
			cprintf("[%08x] closed fd %d\n", thisenv->env_id, fdnum);
		return -E_INVAL;
	}
	*fd_store = fd;
  800ebc:	8b 55 0c             	mov    0xc(%ebp),%edx
  800ebf:	89 02                	mov    %eax,(%edx)
	return 0;
  800ec1:	b8 00 00 00 00       	mov    $0x0,%eax
}
  800ec6:	5d                   	pop    %ebp
  800ec7:	c3                   	ret    
		return -E_INVAL;
  800ec8:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  800ecd:	eb f7                	jmp    800ec6 <fd_lookup+0x3d>
		return -E_INVAL;
  800ecf:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  800ed4:	eb f0                	jmp    800ec6 <fd_lookup+0x3d>
  800ed6:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  800edb:	eb e9                	jmp    800ec6 <fd_lookup+0x3d>

00800edd <dev_lookup>:
	0
};

int
dev_lookup(int dev_id, struct Dev **dev)
{
  800edd:	f3 0f 1e fb          	endbr32 
  800ee1:	55                   	push   %ebp
  800ee2:	89 e5                	mov    %esp,%ebp
  800ee4:	83 ec 08             	sub    $0x8,%esp
  800ee7:	8b 4d 08             	mov    0x8(%ebp),%ecx
  800eea:	ba 48 29 80 00       	mov    $0x802948,%edx
	int i;
	for (i = 0; devtab[i]; i++)
  800eef:	b8 04 30 80 00       	mov    $0x803004,%eax
		if (devtab[i]->dev_id == dev_id) {
  800ef4:	39 08                	cmp    %ecx,(%eax)
  800ef6:	74 33                	je     800f2b <dev_lookup+0x4e>
  800ef8:	83 c2 04             	add    $0x4,%edx
	for (i = 0; devtab[i]; i++)
  800efb:	8b 02                	mov    (%edx),%eax
  800efd:	85 c0                	test   %eax,%eax
  800eff:	75 f3                	jne    800ef4 <dev_lookup+0x17>
			*dev = devtab[i];
			return 0;
		}
	cprintf("[%08x] unknown device type %d\n", thisenv->env_id, dev_id);
  800f01:	a1 04 40 80 00       	mov    0x804004,%eax
  800f06:	8b 40 48             	mov    0x48(%eax),%eax
  800f09:	83 ec 04             	sub    $0x4,%esp
  800f0c:	51                   	push   %ecx
  800f0d:	50                   	push   %eax
  800f0e:	68 cc 28 80 00       	push   $0x8028cc
  800f13:	e8 c0 f2 ff ff       	call   8001d8 <cprintf>
	*dev = 0;
  800f18:	8b 45 0c             	mov    0xc(%ebp),%eax
  800f1b:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
	return -E_INVAL;
  800f21:	83 c4 10             	add    $0x10,%esp
  800f24:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
}
  800f29:	c9                   	leave  
  800f2a:	c3                   	ret    
			*dev = devtab[i];
  800f2b:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800f2e:	89 01                	mov    %eax,(%ecx)
			return 0;
  800f30:	b8 00 00 00 00       	mov    $0x0,%eax
  800f35:	eb f2                	jmp    800f29 <dev_lookup+0x4c>

00800f37 <fd_close>:
{
  800f37:	f3 0f 1e fb          	endbr32 
  800f3b:	55                   	push   %ebp
  800f3c:	89 e5                	mov    %esp,%ebp
  800f3e:	57                   	push   %edi
  800f3f:	56                   	push   %esi
  800f40:	53                   	push   %ebx
  800f41:	83 ec 24             	sub    $0x24,%esp
  800f44:	8b 75 08             	mov    0x8(%ebp),%esi
  800f47:	8b 7d 0c             	mov    0xc(%ebp),%edi
	if ((r = fd_lookup(fd2num(fd), &fd2)) < 0
  800f4a:	8d 45 e4             	lea    -0x1c(%ebp),%eax
  800f4d:	50                   	push   %eax
	return ((uintptr_t) fd - FDTABLE) / PGSIZE;
  800f4e:	8d 86 00 00 00 30    	lea    0x30000000(%esi),%eax
  800f54:	c1 e8 0c             	shr    $0xc,%eax
	if ((r = fd_lookup(fd2num(fd), &fd2)) < 0
  800f57:	50                   	push   %eax
  800f58:	e8 2c ff ff ff       	call   800e89 <fd_lookup>
  800f5d:	89 c3                	mov    %eax,%ebx
  800f5f:	83 c4 10             	add    $0x10,%esp
  800f62:	85 c0                	test   %eax,%eax
  800f64:	78 05                	js     800f6b <fd_close+0x34>
	    || fd != fd2)
  800f66:	39 75 e4             	cmp    %esi,-0x1c(%ebp)
  800f69:	74 16                	je     800f81 <fd_close+0x4a>
		return (must_exist ? r : 0);
  800f6b:	89 f8                	mov    %edi,%eax
  800f6d:	84 c0                	test   %al,%al
  800f6f:	b8 00 00 00 00       	mov    $0x0,%eax
  800f74:	0f 44 d8             	cmove  %eax,%ebx
}
  800f77:	89 d8                	mov    %ebx,%eax
  800f79:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800f7c:	5b                   	pop    %ebx
  800f7d:	5e                   	pop    %esi
  800f7e:	5f                   	pop    %edi
  800f7f:	5d                   	pop    %ebp
  800f80:	c3                   	ret    
	if ((r = dev_lookup(fd->fd_dev_id, &dev)) >= 0) {
  800f81:	83 ec 08             	sub    $0x8,%esp
  800f84:	8d 45 e0             	lea    -0x20(%ebp),%eax
  800f87:	50                   	push   %eax
  800f88:	ff 36                	pushl  (%esi)
  800f8a:	e8 4e ff ff ff       	call   800edd <dev_lookup>
  800f8f:	89 c3                	mov    %eax,%ebx
  800f91:	83 c4 10             	add    $0x10,%esp
  800f94:	85 c0                	test   %eax,%eax
  800f96:	78 1a                	js     800fb2 <fd_close+0x7b>
		if (dev->dev_close)
  800f98:	8b 45 e0             	mov    -0x20(%ebp),%eax
  800f9b:	8b 40 10             	mov    0x10(%eax),%eax
			r = 0;
  800f9e:	bb 00 00 00 00       	mov    $0x0,%ebx
		if (dev->dev_close)
  800fa3:	85 c0                	test   %eax,%eax
  800fa5:	74 0b                	je     800fb2 <fd_close+0x7b>
			r = (*dev->dev_close)(fd);
  800fa7:	83 ec 0c             	sub    $0xc,%esp
  800faa:	56                   	push   %esi
  800fab:	ff d0                	call   *%eax
  800fad:	89 c3                	mov    %eax,%ebx
  800faf:	83 c4 10             	add    $0x10,%esp
	(void) sys_page_unmap(0, fd);
  800fb2:	83 ec 08             	sub    $0x8,%esp
  800fb5:	56                   	push   %esi
  800fb6:	6a 00                	push   $0x0
  800fb8:	e8 c3 fc ff ff       	call   800c80 <sys_page_unmap>
	return r;
  800fbd:	83 c4 10             	add    $0x10,%esp
  800fc0:	eb b5                	jmp    800f77 <fd_close+0x40>

00800fc2 <close>:

int
close(int fdnum)
{
  800fc2:	f3 0f 1e fb          	endbr32 
  800fc6:	55                   	push   %ebp
  800fc7:	89 e5                	mov    %esp,%ebp
  800fc9:	83 ec 20             	sub    $0x20,%esp
	struct Fd *fd;
	int r;

	if ((r = fd_lookup(fdnum, &fd)) < 0)
  800fcc:	8d 45 f4             	lea    -0xc(%ebp),%eax
  800fcf:	50                   	push   %eax
  800fd0:	ff 75 08             	pushl  0x8(%ebp)
  800fd3:	e8 b1 fe ff ff       	call   800e89 <fd_lookup>
  800fd8:	83 c4 10             	add    $0x10,%esp
  800fdb:	85 c0                	test   %eax,%eax
  800fdd:	79 02                	jns    800fe1 <close+0x1f>
		return r;
	else
		return fd_close(fd, 1);
}
  800fdf:	c9                   	leave  
  800fe0:	c3                   	ret    
		return fd_close(fd, 1);
  800fe1:	83 ec 08             	sub    $0x8,%esp
  800fe4:	6a 01                	push   $0x1
  800fe6:	ff 75 f4             	pushl  -0xc(%ebp)
  800fe9:	e8 49 ff ff ff       	call   800f37 <fd_close>
  800fee:	83 c4 10             	add    $0x10,%esp
  800ff1:	eb ec                	jmp    800fdf <close+0x1d>

00800ff3 <close_all>:

void
close_all(void)
{
  800ff3:	f3 0f 1e fb          	endbr32 
  800ff7:	55                   	push   %ebp
  800ff8:	89 e5                	mov    %esp,%ebp
  800ffa:	53                   	push   %ebx
  800ffb:	83 ec 04             	sub    $0x4,%esp
	int i;
	for (i = 0; i < MAXFD; i++)
  800ffe:	bb 00 00 00 00       	mov    $0x0,%ebx
		close(i);
  801003:	83 ec 0c             	sub    $0xc,%esp
  801006:	53                   	push   %ebx
  801007:	e8 b6 ff ff ff       	call   800fc2 <close>
	for (i = 0; i < MAXFD; i++)
  80100c:	83 c3 01             	add    $0x1,%ebx
  80100f:	83 c4 10             	add    $0x10,%esp
  801012:	83 fb 20             	cmp    $0x20,%ebx
  801015:	75 ec                	jne    801003 <close_all+0x10>
}
  801017:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  80101a:	c9                   	leave  
  80101b:	c3                   	ret    

0080101c <dup>:
// file and the file offset of the other.
// Closes any previously open file descriptor at 'newfdnum'.
// This is implemented using virtual memory tricks (of course!).
int
dup(int oldfdnum, int newfdnum)
{
  80101c:	f3 0f 1e fb          	endbr32 
  801020:	55                   	push   %ebp
  801021:	89 e5                	mov    %esp,%ebp
  801023:	57                   	push   %edi
  801024:	56                   	push   %esi
  801025:	53                   	push   %ebx
  801026:	83 ec 24             	sub    $0x24,%esp
	int r;
	char *ova, *nva;
	pte_t pte;
	struct Fd *oldfd, *newfd;

	if ((r = fd_lookup(oldfdnum, &oldfd)) < 0)
  801029:	8d 45 e4             	lea    -0x1c(%ebp),%eax
  80102c:	50                   	push   %eax
  80102d:	ff 75 08             	pushl  0x8(%ebp)
  801030:	e8 54 fe ff ff       	call   800e89 <fd_lookup>
  801035:	89 c3                	mov    %eax,%ebx
  801037:	83 c4 10             	add    $0x10,%esp
  80103a:	85 c0                	test   %eax,%eax
  80103c:	0f 88 81 00 00 00    	js     8010c3 <dup+0xa7>
		return r;
	close(newfdnum);
  801042:	83 ec 0c             	sub    $0xc,%esp
  801045:	ff 75 0c             	pushl  0xc(%ebp)
  801048:	e8 75 ff ff ff       	call   800fc2 <close>

	newfd = INDEX2FD(newfdnum);
  80104d:	8b 75 0c             	mov    0xc(%ebp),%esi
  801050:	c1 e6 0c             	shl    $0xc,%esi
  801053:	81 ee 00 00 00 30    	sub    $0x30000000,%esi
	ova = fd2data(oldfd);
  801059:	83 c4 04             	add    $0x4,%esp
  80105c:	ff 75 e4             	pushl  -0x1c(%ebp)
  80105f:	e8 b4 fd ff ff       	call   800e18 <fd2data>
  801064:	89 c3                	mov    %eax,%ebx
	nva = fd2data(newfd);
  801066:	89 34 24             	mov    %esi,(%esp)
  801069:	e8 aa fd ff ff       	call   800e18 <fd2data>
  80106e:	83 c4 10             	add    $0x10,%esp
  801071:	89 c7                	mov    %eax,%edi

	if ((uvpd[PDX(ova)] & PTE_P) && (uvpt[PGNUM(ova)] & PTE_P))
  801073:	89 d8                	mov    %ebx,%eax
  801075:	c1 e8 16             	shr    $0x16,%eax
  801078:	8b 04 85 00 d0 7b ef 	mov    -0x10843000(,%eax,4),%eax
  80107f:	a8 01                	test   $0x1,%al
  801081:	74 11                	je     801094 <dup+0x78>
  801083:	89 d8                	mov    %ebx,%eax
  801085:	c1 e8 0c             	shr    $0xc,%eax
  801088:	8b 14 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%edx
  80108f:	f6 c2 01             	test   $0x1,%dl
  801092:	75 39                	jne    8010cd <dup+0xb1>
		if ((r = sys_page_map(0, ova, 0, nva, uvpt[PGNUM(ova)] & PTE_SYSCALL)) < 0)
			goto err;
	if ((r = sys_page_map(0, oldfd, 0, newfd, uvpt[PGNUM(oldfd)] & PTE_SYSCALL)) < 0)
  801094:	8b 55 e4             	mov    -0x1c(%ebp),%edx
  801097:	89 d0                	mov    %edx,%eax
  801099:	c1 e8 0c             	shr    $0xc,%eax
  80109c:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
  8010a3:	83 ec 0c             	sub    $0xc,%esp
  8010a6:	25 07 0e 00 00       	and    $0xe07,%eax
  8010ab:	50                   	push   %eax
  8010ac:	56                   	push   %esi
  8010ad:	6a 00                	push   $0x0
  8010af:	52                   	push   %edx
  8010b0:	6a 00                	push   $0x0
  8010b2:	e8 83 fb ff ff       	call   800c3a <sys_page_map>
  8010b7:	89 c3                	mov    %eax,%ebx
  8010b9:	83 c4 20             	add    $0x20,%esp
  8010bc:	85 c0                	test   %eax,%eax
  8010be:	78 31                	js     8010f1 <dup+0xd5>
		goto err;

	return newfdnum;
  8010c0:	8b 5d 0c             	mov    0xc(%ebp),%ebx

err:
	sys_page_unmap(0, newfd);
	sys_page_unmap(0, nva);
	return r;
}
  8010c3:	89 d8                	mov    %ebx,%eax
  8010c5:	8d 65 f4             	lea    -0xc(%ebp),%esp
  8010c8:	5b                   	pop    %ebx
  8010c9:	5e                   	pop    %esi
  8010ca:	5f                   	pop    %edi
  8010cb:	5d                   	pop    %ebp
  8010cc:	c3                   	ret    
		if ((r = sys_page_map(0, ova, 0, nva, uvpt[PGNUM(ova)] & PTE_SYSCALL)) < 0)
  8010cd:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
  8010d4:	83 ec 0c             	sub    $0xc,%esp
  8010d7:	25 07 0e 00 00       	and    $0xe07,%eax
  8010dc:	50                   	push   %eax
  8010dd:	57                   	push   %edi
  8010de:	6a 00                	push   $0x0
  8010e0:	53                   	push   %ebx
  8010e1:	6a 00                	push   $0x0
  8010e3:	e8 52 fb ff ff       	call   800c3a <sys_page_map>
  8010e8:	89 c3                	mov    %eax,%ebx
  8010ea:	83 c4 20             	add    $0x20,%esp
  8010ed:	85 c0                	test   %eax,%eax
  8010ef:	79 a3                	jns    801094 <dup+0x78>
	sys_page_unmap(0, newfd);
  8010f1:	83 ec 08             	sub    $0x8,%esp
  8010f4:	56                   	push   %esi
  8010f5:	6a 00                	push   $0x0
  8010f7:	e8 84 fb ff ff       	call   800c80 <sys_page_unmap>
	sys_page_unmap(0, nva);
  8010fc:	83 c4 08             	add    $0x8,%esp
  8010ff:	57                   	push   %edi
  801100:	6a 00                	push   $0x0
  801102:	e8 79 fb ff ff       	call   800c80 <sys_page_unmap>
	return r;
  801107:	83 c4 10             	add    $0x10,%esp
  80110a:	eb b7                	jmp    8010c3 <dup+0xa7>

0080110c <read>:

ssize_t
read(int fdnum, void *buf, size_t n)
{
  80110c:	f3 0f 1e fb          	endbr32 
  801110:	55                   	push   %ebp
  801111:	89 e5                	mov    %esp,%ebp
  801113:	53                   	push   %ebx
  801114:	83 ec 1c             	sub    $0x1c,%esp
  801117:	8b 5d 08             	mov    0x8(%ebp),%ebx
	int r;
	struct Dev *dev;
	struct Fd *fd;

	if ((r = fd_lookup(fdnum, &fd)) < 0
  80111a:	8d 45 f0             	lea    -0x10(%ebp),%eax
  80111d:	50                   	push   %eax
  80111e:	53                   	push   %ebx
  80111f:	e8 65 fd ff ff       	call   800e89 <fd_lookup>
  801124:	83 c4 10             	add    $0x10,%esp
  801127:	85 c0                	test   %eax,%eax
  801129:	78 3f                	js     80116a <read+0x5e>
	    || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
  80112b:	83 ec 08             	sub    $0x8,%esp
  80112e:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801131:	50                   	push   %eax
  801132:	8b 45 f0             	mov    -0x10(%ebp),%eax
  801135:	ff 30                	pushl  (%eax)
  801137:	e8 a1 fd ff ff       	call   800edd <dev_lookup>
  80113c:	83 c4 10             	add    $0x10,%esp
  80113f:	85 c0                	test   %eax,%eax
  801141:	78 27                	js     80116a <read+0x5e>
		return r;
	if ((fd->fd_omode & O_ACCMODE) == O_WRONLY) {
  801143:	8b 55 f0             	mov    -0x10(%ebp),%edx
  801146:	8b 42 08             	mov    0x8(%edx),%eax
  801149:	83 e0 03             	and    $0x3,%eax
  80114c:	83 f8 01             	cmp    $0x1,%eax
  80114f:	74 1e                	je     80116f <read+0x63>
		cprintf("[%08x] read %d -- bad mode\n", thisenv->env_id, fdnum);
		return -E_INVAL;
	}
	if (!dev->dev_read)
  801151:	8b 45 f4             	mov    -0xc(%ebp),%eax
  801154:	8b 40 08             	mov    0x8(%eax),%eax
  801157:	85 c0                	test   %eax,%eax
  801159:	74 35                	je     801190 <read+0x84>
		return -E_NOT_SUPP;
	return (*dev->dev_read)(fd, buf, n);
  80115b:	83 ec 04             	sub    $0x4,%esp
  80115e:	ff 75 10             	pushl  0x10(%ebp)
  801161:	ff 75 0c             	pushl  0xc(%ebp)
  801164:	52                   	push   %edx
  801165:	ff d0                	call   *%eax
  801167:	83 c4 10             	add    $0x10,%esp
}
  80116a:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  80116d:	c9                   	leave  
  80116e:	c3                   	ret    
		cprintf("[%08x] read %d -- bad mode\n", thisenv->env_id, fdnum);
  80116f:	a1 04 40 80 00       	mov    0x804004,%eax
  801174:	8b 40 48             	mov    0x48(%eax),%eax
  801177:	83 ec 04             	sub    $0x4,%esp
  80117a:	53                   	push   %ebx
  80117b:	50                   	push   %eax
  80117c:	68 0d 29 80 00       	push   $0x80290d
  801181:	e8 52 f0 ff ff       	call   8001d8 <cprintf>
		return -E_INVAL;
  801186:	83 c4 10             	add    $0x10,%esp
  801189:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  80118e:	eb da                	jmp    80116a <read+0x5e>
		return -E_NOT_SUPP;
  801190:	b8 f1 ff ff ff       	mov    $0xfffffff1,%eax
  801195:	eb d3                	jmp    80116a <read+0x5e>

00801197 <readn>:

ssize_t
readn(int fdnum, void *buf, size_t n)
{
  801197:	f3 0f 1e fb          	endbr32 
  80119b:	55                   	push   %ebp
  80119c:	89 e5                	mov    %esp,%ebp
  80119e:	57                   	push   %edi
  80119f:	56                   	push   %esi
  8011a0:	53                   	push   %ebx
  8011a1:	83 ec 0c             	sub    $0xc,%esp
  8011a4:	8b 7d 08             	mov    0x8(%ebp),%edi
  8011a7:	8b 75 10             	mov    0x10(%ebp),%esi
	int m, tot;

	for (tot = 0; tot < n; tot += m) {
  8011aa:	bb 00 00 00 00       	mov    $0x0,%ebx
  8011af:	eb 02                	jmp    8011b3 <readn+0x1c>
  8011b1:	01 c3                	add    %eax,%ebx
  8011b3:	39 f3                	cmp    %esi,%ebx
  8011b5:	73 21                	jae    8011d8 <readn+0x41>
		m = read(fdnum, (char*)buf + tot, n - tot);
  8011b7:	83 ec 04             	sub    $0x4,%esp
  8011ba:	89 f0                	mov    %esi,%eax
  8011bc:	29 d8                	sub    %ebx,%eax
  8011be:	50                   	push   %eax
  8011bf:	89 d8                	mov    %ebx,%eax
  8011c1:	03 45 0c             	add    0xc(%ebp),%eax
  8011c4:	50                   	push   %eax
  8011c5:	57                   	push   %edi
  8011c6:	e8 41 ff ff ff       	call   80110c <read>
		if (m < 0)
  8011cb:	83 c4 10             	add    $0x10,%esp
  8011ce:	85 c0                	test   %eax,%eax
  8011d0:	78 04                	js     8011d6 <readn+0x3f>
			return m;
		if (m == 0)
  8011d2:	75 dd                	jne    8011b1 <readn+0x1a>
  8011d4:	eb 02                	jmp    8011d8 <readn+0x41>
		m = read(fdnum, (char*)buf + tot, n - tot);
  8011d6:	89 c3                	mov    %eax,%ebx
			break;
	}
	return tot;
}
  8011d8:	89 d8                	mov    %ebx,%eax
  8011da:	8d 65 f4             	lea    -0xc(%ebp),%esp
  8011dd:	5b                   	pop    %ebx
  8011de:	5e                   	pop    %esi
  8011df:	5f                   	pop    %edi
  8011e0:	5d                   	pop    %ebp
  8011e1:	c3                   	ret    

008011e2 <write>:

ssize_t
write(int fdnum, const void *buf, size_t n)
{
  8011e2:	f3 0f 1e fb          	endbr32 
  8011e6:	55                   	push   %ebp
  8011e7:	89 e5                	mov    %esp,%ebp
  8011e9:	53                   	push   %ebx
  8011ea:	83 ec 1c             	sub    $0x1c,%esp
  8011ed:	8b 5d 08             	mov    0x8(%ebp),%ebx
	int r;
	struct Dev *dev;
	struct Fd *fd;

	if ((r = fd_lookup(fdnum, &fd)) < 0
  8011f0:	8d 45 f0             	lea    -0x10(%ebp),%eax
  8011f3:	50                   	push   %eax
  8011f4:	53                   	push   %ebx
  8011f5:	e8 8f fc ff ff       	call   800e89 <fd_lookup>
  8011fa:	83 c4 10             	add    $0x10,%esp
  8011fd:	85 c0                	test   %eax,%eax
  8011ff:	78 3a                	js     80123b <write+0x59>
	    || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
  801201:	83 ec 08             	sub    $0x8,%esp
  801204:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801207:	50                   	push   %eax
  801208:	8b 45 f0             	mov    -0x10(%ebp),%eax
  80120b:	ff 30                	pushl  (%eax)
  80120d:	e8 cb fc ff ff       	call   800edd <dev_lookup>
  801212:	83 c4 10             	add    $0x10,%esp
  801215:	85 c0                	test   %eax,%eax
  801217:	78 22                	js     80123b <write+0x59>
		return r;
	if ((fd->fd_omode & O_ACCMODE) == O_RDONLY) {
  801219:	8b 45 f0             	mov    -0x10(%ebp),%eax
  80121c:	f6 40 08 03          	testb  $0x3,0x8(%eax)
  801220:	74 1e                	je     801240 <write+0x5e>
		return -E_INVAL;
	}
	if (debug)
		cprintf("write %d %p %d via dev %s\n",
			fdnum, buf, n, dev->dev_name);
	if (!dev->dev_write)
  801222:	8b 55 f4             	mov    -0xc(%ebp),%edx
  801225:	8b 52 0c             	mov    0xc(%edx),%edx
  801228:	85 d2                	test   %edx,%edx
  80122a:	74 35                	je     801261 <write+0x7f>
		return -E_NOT_SUPP;
	return (*dev->dev_write)(fd, buf, n);
  80122c:	83 ec 04             	sub    $0x4,%esp
  80122f:	ff 75 10             	pushl  0x10(%ebp)
  801232:	ff 75 0c             	pushl  0xc(%ebp)
  801235:	50                   	push   %eax
  801236:	ff d2                	call   *%edx
  801238:	83 c4 10             	add    $0x10,%esp
}
  80123b:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  80123e:	c9                   	leave  
  80123f:	c3                   	ret    
		cprintf("[%08x] write %d -- bad mode\n", thisenv->env_id, fdnum);
  801240:	a1 04 40 80 00       	mov    0x804004,%eax
  801245:	8b 40 48             	mov    0x48(%eax),%eax
  801248:	83 ec 04             	sub    $0x4,%esp
  80124b:	53                   	push   %ebx
  80124c:	50                   	push   %eax
  80124d:	68 29 29 80 00       	push   $0x802929
  801252:	e8 81 ef ff ff       	call   8001d8 <cprintf>
		return -E_INVAL;
  801257:	83 c4 10             	add    $0x10,%esp
  80125a:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  80125f:	eb da                	jmp    80123b <write+0x59>
		return -E_NOT_SUPP;
  801261:	b8 f1 ff ff ff       	mov    $0xfffffff1,%eax
  801266:	eb d3                	jmp    80123b <write+0x59>

00801268 <seek>:

int
seek(int fdnum, off_t offset)
{
  801268:	f3 0f 1e fb          	endbr32 
  80126c:	55                   	push   %ebp
  80126d:	89 e5                	mov    %esp,%ebp
  80126f:	83 ec 20             	sub    $0x20,%esp
	int r;
	struct Fd *fd;

	if ((r = fd_lookup(fdnum, &fd)) < 0)
  801272:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801275:	50                   	push   %eax
  801276:	ff 75 08             	pushl  0x8(%ebp)
  801279:	e8 0b fc ff ff       	call   800e89 <fd_lookup>
  80127e:	83 c4 10             	add    $0x10,%esp
  801281:	85 c0                	test   %eax,%eax
  801283:	78 0e                	js     801293 <seek+0x2b>
		return r;
	fd->fd_offset = offset;
  801285:	8b 55 0c             	mov    0xc(%ebp),%edx
  801288:	8b 45 f4             	mov    -0xc(%ebp),%eax
  80128b:	89 50 04             	mov    %edx,0x4(%eax)
	return 0;
  80128e:	b8 00 00 00 00       	mov    $0x0,%eax
}
  801293:	c9                   	leave  
  801294:	c3                   	ret    

00801295 <ftruncate>:

int
ftruncate(int fdnum, off_t newsize)
{
  801295:	f3 0f 1e fb          	endbr32 
  801299:	55                   	push   %ebp
  80129a:	89 e5                	mov    %esp,%ebp
  80129c:	53                   	push   %ebx
  80129d:	83 ec 1c             	sub    $0x1c,%esp
  8012a0:	8b 5d 08             	mov    0x8(%ebp),%ebx
	int r;
	struct Dev *dev;
	struct Fd *fd;
	if ((r = fd_lookup(fdnum, &fd)) < 0
  8012a3:	8d 45 f0             	lea    -0x10(%ebp),%eax
  8012a6:	50                   	push   %eax
  8012a7:	53                   	push   %ebx
  8012a8:	e8 dc fb ff ff       	call   800e89 <fd_lookup>
  8012ad:	83 c4 10             	add    $0x10,%esp
  8012b0:	85 c0                	test   %eax,%eax
  8012b2:	78 37                	js     8012eb <ftruncate+0x56>
	    || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
  8012b4:	83 ec 08             	sub    $0x8,%esp
  8012b7:	8d 45 f4             	lea    -0xc(%ebp),%eax
  8012ba:	50                   	push   %eax
  8012bb:	8b 45 f0             	mov    -0x10(%ebp),%eax
  8012be:	ff 30                	pushl  (%eax)
  8012c0:	e8 18 fc ff ff       	call   800edd <dev_lookup>
  8012c5:	83 c4 10             	add    $0x10,%esp
  8012c8:	85 c0                	test   %eax,%eax
  8012ca:	78 1f                	js     8012eb <ftruncate+0x56>
		return r;
	if ((fd->fd_omode & O_ACCMODE) == O_RDONLY) {
  8012cc:	8b 45 f0             	mov    -0x10(%ebp),%eax
  8012cf:	f6 40 08 03          	testb  $0x3,0x8(%eax)
  8012d3:	74 1b                	je     8012f0 <ftruncate+0x5b>
		cprintf("[%08x] ftruncate %d -- bad mode\n",
			thisenv->env_id, fdnum);
		return -E_INVAL;
	}
	if (!dev->dev_trunc)
  8012d5:	8b 55 f4             	mov    -0xc(%ebp),%edx
  8012d8:	8b 52 18             	mov    0x18(%edx),%edx
  8012db:	85 d2                	test   %edx,%edx
  8012dd:	74 32                	je     801311 <ftruncate+0x7c>
		return -E_NOT_SUPP;
	return (*dev->dev_trunc)(fd, newsize);
  8012df:	83 ec 08             	sub    $0x8,%esp
  8012e2:	ff 75 0c             	pushl  0xc(%ebp)
  8012e5:	50                   	push   %eax
  8012e6:	ff d2                	call   *%edx
  8012e8:	83 c4 10             	add    $0x10,%esp
}
  8012eb:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  8012ee:	c9                   	leave  
  8012ef:	c3                   	ret    
			thisenv->env_id, fdnum);
  8012f0:	a1 04 40 80 00       	mov    0x804004,%eax
		cprintf("[%08x] ftruncate %d -- bad mode\n",
  8012f5:	8b 40 48             	mov    0x48(%eax),%eax
  8012f8:	83 ec 04             	sub    $0x4,%esp
  8012fb:	53                   	push   %ebx
  8012fc:	50                   	push   %eax
  8012fd:	68 ec 28 80 00       	push   $0x8028ec
  801302:	e8 d1 ee ff ff       	call   8001d8 <cprintf>
		return -E_INVAL;
  801307:	83 c4 10             	add    $0x10,%esp
  80130a:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  80130f:	eb da                	jmp    8012eb <ftruncate+0x56>
		return -E_NOT_SUPP;
  801311:	b8 f1 ff ff ff       	mov    $0xfffffff1,%eax
  801316:	eb d3                	jmp    8012eb <ftruncate+0x56>

00801318 <fstat>:

int
fstat(int fdnum, struct Stat *stat)
{
  801318:	f3 0f 1e fb          	endbr32 
  80131c:	55                   	push   %ebp
  80131d:	89 e5                	mov    %esp,%ebp
  80131f:	53                   	push   %ebx
  801320:	83 ec 1c             	sub    $0x1c,%esp
  801323:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	int r;
	struct Dev *dev;
	struct Fd *fd;

	if ((r = fd_lookup(fdnum, &fd)) < 0
  801326:	8d 45 f0             	lea    -0x10(%ebp),%eax
  801329:	50                   	push   %eax
  80132a:	ff 75 08             	pushl  0x8(%ebp)
  80132d:	e8 57 fb ff ff       	call   800e89 <fd_lookup>
  801332:	83 c4 10             	add    $0x10,%esp
  801335:	85 c0                	test   %eax,%eax
  801337:	78 4b                	js     801384 <fstat+0x6c>
	    || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
  801339:	83 ec 08             	sub    $0x8,%esp
  80133c:	8d 45 f4             	lea    -0xc(%ebp),%eax
  80133f:	50                   	push   %eax
  801340:	8b 45 f0             	mov    -0x10(%ebp),%eax
  801343:	ff 30                	pushl  (%eax)
  801345:	e8 93 fb ff ff       	call   800edd <dev_lookup>
  80134a:	83 c4 10             	add    $0x10,%esp
  80134d:	85 c0                	test   %eax,%eax
  80134f:	78 33                	js     801384 <fstat+0x6c>
		return r;
	if (!dev->dev_stat)
  801351:	8b 45 f4             	mov    -0xc(%ebp),%eax
  801354:	83 78 14 00          	cmpl   $0x0,0x14(%eax)
  801358:	74 2f                	je     801389 <fstat+0x71>
		return -E_NOT_SUPP;
	stat->st_name[0] = 0;
  80135a:	c6 03 00             	movb   $0x0,(%ebx)
	stat->st_size = 0;
  80135d:	c7 83 80 00 00 00 00 	movl   $0x0,0x80(%ebx)
  801364:	00 00 00 
	stat->st_isdir = 0;
  801367:	c7 83 84 00 00 00 00 	movl   $0x0,0x84(%ebx)
  80136e:	00 00 00 
	stat->st_dev = dev;
  801371:	89 83 88 00 00 00    	mov    %eax,0x88(%ebx)
	return (*dev->dev_stat)(fd, stat);
  801377:	83 ec 08             	sub    $0x8,%esp
  80137a:	53                   	push   %ebx
  80137b:	ff 75 f0             	pushl  -0x10(%ebp)
  80137e:	ff 50 14             	call   *0x14(%eax)
  801381:	83 c4 10             	add    $0x10,%esp
}
  801384:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  801387:	c9                   	leave  
  801388:	c3                   	ret    
		return -E_NOT_SUPP;
  801389:	b8 f1 ff ff ff       	mov    $0xfffffff1,%eax
  80138e:	eb f4                	jmp    801384 <fstat+0x6c>

00801390 <stat>:

int
stat(const char *path, struct Stat *stat)
{
  801390:	f3 0f 1e fb          	endbr32 
  801394:	55                   	push   %ebp
  801395:	89 e5                	mov    %esp,%ebp
  801397:	56                   	push   %esi
  801398:	53                   	push   %ebx
	int fd, r;

	if ((fd = open(path, O_RDONLY)) < 0)
  801399:	83 ec 08             	sub    $0x8,%esp
  80139c:	6a 00                	push   $0x0
  80139e:	ff 75 08             	pushl  0x8(%ebp)
  8013a1:	e8 fb 01 00 00       	call   8015a1 <open>
  8013a6:	89 c3                	mov    %eax,%ebx
  8013a8:	83 c4 10             	add    $0x10,%esp
  8013ab:	85 c0                	test   %eax,%eax
  8013ad:	78 1b                	js     8013ca <stat+0x3a>
		return fd;
	r = fstat(fd, stat);
  8013af:	83 ec 08             	sub    $0x8,%esp
  8013b2:	ff 75 0c             	pushl  0xc(%ebp)
  8013b5:	50                   	push   %eax
  8013b6:	e8 5d ff ff ff       	call   801318 <fstat>
  8013bb:	89 c6                	mov    %eax,%esi
	close(fd);
  8013bd:	89 1c 24             	mov    %ebx,(%esp)
  8013c0:	e8 fd fb ff ff       	call   800fc2 <close>
	return r;
  8013c5:	83 c4 10             	add    $0x10,%esp
  8013c8:	89 f3                	mov    %esi,%ebx
}
  8013ca:	89 d8                	mov    %ebx,%eax
  8013cc:	8d 65 f8             	lea    -0x8(%ebp),%esp
  8013cf:	5b                   	pop    %ebx
  8013d0:	5e                   	pop    %esi
  8013d1:	5d                   	pop    %ebp
  8013d2:	c3                   	ret    

008013d3 <fsipc>:
// type: request code, passed as the simple integer IPC value.
// dstva: virtual address at which to receive reply page, 0 if none.
// Returns result from the file server.
static int
fsipc(unsigned type, void *dstva)
{
  8013d3:	55                   	push   %ebp
  8013d4:	89 e5                	mov    %esp,%ebp
  8013d6:	56                   	push   %esi
  8013d7:	53                   	push   %ebx
  8013d8:	89 c6                	mov    %eax,%esi
  8013da:	89 d3                	mov    %edx,%ebx
	static envid_t fsenv;
	if (fsenv == 0)
  8013dc:	83 3d 00 40 80 00 00 	cmpl   $0x0,0x804000
  8013e3:	74 27                	je     80140c <fsipc+0x39>
	static_assert(sizeof(fsipcbuf) == PGSIZE);

	if (debug)
		cprintf("[%08x] fsipc %d %08x\n", thisenv->env_id, type, *(uint32_t *)&fsipcbuf);

	ipc_send(fsenv, type, &fsipcbuf, PTE_P | PTE_W | PTE_U);
  8013e5:	6a 07                	push   $0x7
  8013e7:	68 00 50 80 00       	push   $0x805000
  8013ec:	56                   	push   %esi
  8013ed:	ff 35 00 40 80 00    	pushl  0x804000
  8013f3:	e8 de 0d 00 00       	call   8021d6 <ipc_send>
	return ipc_recv(NULL, dstva, NULL);
  8013f8:	83 c4 0c             	add    $0xc,%esp
  8013fb:	6a 00                	push   $0x0
  8013fd:	53                   	push   %ebx
  8013fe:	6a 00                	push   $0x0
  801400:	e8 50 0d 00 00       	call   802155 <ipc_recv>
}
  801405:	8d 65 f8             	lea    -0x8(%ebp),%esp
  801408:	5b                   	pop    %ebx
  801409:	5e                   	pop    %esi
  80140a:	5d                   	pop    %ebp
  80140b:	c3                   	ret    
		fsenv = ipc_find_env(ENV_TYPE_FS);
  80140c:	83 ec 0c             	sub    $0xc,%esp
  80140f:	6a 01                	push   $0x1
  801411:	e8 18 0e 00 00       	call   80222e <ipc_find_env>
  801416:	a3 00 40 80 00       	mov    %eax,0x804000
  80141b:	83 c4 10             	add    $0x10,%esp
  80141e:	eb c5                	jmp    8013e5 <fsipc+0x12>

00801420 <devfile_trunc>:
}

// Truncate or extend an open file to 'size' bytes
static int
devfile_trunc(struct Fd *fd, off_t newsize)
{
  801420:	f3 0f 1e fb          	endbr32 
  801424:	55                   	push   %ebp
  801425:	89 e5                	mov    %esp,%ebp
  801427:	83 ec 08             	sub    $0x8,%esp
	fsipcbuf.set_size.req_fileid = fd->fd_file.id;
  80142a:	8b 45 08             	mov    0x8(%ebp),%eax
  80142d:	8b 40 0c             	mov    0xc(%eax),%eax
  801430:	a3 00 50 80 00       	mov    %eax,0x805000
	fsipcbuf.set_size.req_size = newsize;
  801435:	8b 45 0c             	mov    0xc(%ebp),%eax
  801438:	a3 04 50 80 00       	mov    %eax,0x805004
	return fsipc(FSREQ_SET_SIZE, NULL);
  80143d:	ba 00 00 00 00       	mov    $0x0,%edx
  801442:	b8 02 00 00 00       	mov    $0x2,%eax
  801447:	e8 87 ff ff ff       	call   8013d3 <fsipc>
}
  80144c:	c9                   	leave  
  80144d:	c3                   	ret    

0080144e <devfile_flush>:
{
  80144e:	f3 0f 1e fb          	endbr32 
  801452:	55                   	push   %ebp
  801453:	89 e5                	mov    %esp,%ebp
  801455:	83 ec 08             	sub    $0x8,%esp
	fsipcbuf.flush.req_fileid = fd->fd_file.id;
  801458:	8b 45 08             	mov    0x8(%ebp),%eax
  80145b:	8b 40 0c             	mov    0xc(%eax),%eax
  80145e:	a3 00 50 80 00       	mov    %eax,0x805000
	return fsipc(FSREQ_FLUSH, NULL);
  801463:	ba 00 00 00 00       	mov    $0x0,%edx
  801468:	b8 06 00 00 00       	mov    $0x6,%eax
  80146d:	e8 61 ff ff ff       	call   8013d3 <fsipc>
}
  801472:	c9                   	leave  
  801473:	c3                   	ret    

00801474 <devfile_stat>:
{
  801474:	f3 0f 1e fb          	endbr32 
  801478:	55                   	push   %ebp
  801479:	89 e5                	mov    %esp,%ebp
  80147b:	53                   	push   %ebx
  80147c:	83 ec 04             	sub    $0x4,%esp
  80147f:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	fsipcbuf.stat.req_fileid = fd->fd_file.id;
  801482:	8b 45 08             	mov    0x8(%ebp),%eax
  801485:	8b 40 0c             	mov    0xc(%eax),%eax
  801488:	a3 00 50 80 00       	mov    %eax,0x805000
	if ((r = fsipc(FSREQ_STAT, NULL)) < 0)
  80148d:	ba 00 00 00 00       	mov    $0x0,%edx
  801492:	b8 05 00 00 00       	mov    $0x5,%eax
  801497:	e8 37 ff ff ff       	call   8013d3 <fsipc>
  80149c:	85 c0                	test   %eax,%eax
  80149e:	78 2c                	js     8014cc <devfile_stat+0x58>
	strcpy(st->st_name, fsipcbuf.statRet.ret_name);
  8014a0:	83 ec 08             	sub    $0x8,%esp
  8014a3:	68 00 50 80 00       	push   $0x805000
  8014a8:	53                   	push   %ebx
  8014a9:	e8 03 f3 ff ff       	call   8007b1 <strcpy>
	st->st_size = fsipcbuf.statRet.ret_size;
  8014ae:	a1 80 50 80 00       	mov    0x805080,%eax
  8014b3:	89 83 80 00 00 00    	mov    %eax,0x80(%ebx)
	st->st_isdir = fsipcbuf.statRet.ret_isdir;
  8014b9:	a1 84 50 80 00       	mov    0x805084,%eax
  8014be:	89 83 84 00 00 00    	mov    %eax,0x84(%ebx)
	return 0;
  8014c4:	83 c4 10             	add    $0x10,%esp
  8014c7:	b8 00 00 00 00       	mov    $0x0,%eax
}
  8014cc:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  8014cf:	c9                   	leave  
  8014d0:	c3                   	ret    

008014d1 <devfile_write>:
{
  8014d1:	f3 0f 1e fb          	endbr32 
  8014d5:	55                   	push   %ebp
  8014d6:	89 e5                	mov    %esp,%ebp
  8014d8:	83 ec 0c             	sub    $0xc,%esp
  8014db:	8b 45 10             	mov    0x10(%ebp),%eax
  8014de:	3d f8 0f 00 00       	cmp    $0xff8,%eax
  8014e3:	ba f8 0f 00 00       	mov    $0xff8,%edx
  8014e8:	0f 47 c2             	cmova  %edx,%eax
	fsipcbuf.write.req_fileid = fd->fd_file.id;
  8014eb:	8b 55 08             	mov    0x8(%ebp),%edx
  8014ee:	8b 52 0c             	mov    0xc(%edx),%edx
  8014f1:	89 15 00 50 80 00    	mov    %edx,0x805000
	fsipcbuf.write.req_n = n;
  8014f7:	a3 04 50 80 00       	mov    %eax,0x805004
	memmove(fsipcbuf.write.req_buf, buf, n);
  8014fc:	50                   	push   %eax
  8014fd:	ff 75 0c             	pushl  0xc(%ebp)
  801500:	68 08 50 80 00       	push   $0x805008
  801505:	e8 5d f4 ff ff       	call   800967 <memmove>
	return fsipc(FSREQ_WRITE, NULL);}
  80150a:	ba 00 00 00 00       	mov    $0x0,%edx
  80150f:	b8 04 00 00 00       	mov    $0x4,%eax
  801514:	e8 ba fe ff ff       	call   8013d3 <fsipc>
  801519:	c9                   	leave  
  80151a:	c3                   	ret    

0080151b <devfile_read>:
{
  80151b:	f3 0f 1e fb          	endbr32 
  80151f:	55                   	push   %ebp
  801520:	89 e5                	mov    %esp,%ebp
  801522:	56                   	push   %esi
  801523:	53                   	push   %ebx
  801524:	8b 75 10             	mov    0x10(%ebp),%esi
	fsipcbuf.read.req_fileid = fd->fd_file.id;
  801527:	8b 45 08             	mov    0x8(%ebp),%eax
  80152a:	8b 40 0c             	mov    0xc(%eax),%eax
  80152d:	a3 00 50 80 00       	mov    %eax,0x805000
	fsipcbuf.read.req_n = n;
  801532:	89 35 04 50 80 00    	mov    %esi,0x805004
	if ((r = fsipc(FSREQ_READ, NULL)) < 0)
  801538:	ba 00 00 00 00       	mov    $0x0,%edx
  80153d:	b8 03 00 00 00       	mov    $0x3,%eax
  801542:	e8 8c fe ff ff       	call   8013d3 <fsipc>
  801547:	89 c3                	mov    %eax,%ebx
  801549:	85 c0                	test   %eax,%eax
  80154b:	78 1f                	js     80156c <devfile_read+0x51>
	assert(r <= n);
  80154d:	39 f0                	cmp    %esi,%eax
  80154f:	77 24                	ja     801575 <devfile_read+0x5a>
	assert(r <= PGSIZE);
  801551:	3d 00 10 00 00       	cmp    $0x1000,%eax
  801556:	7f 33                	jg     80158b <devfile_read+0x70>
	memmove(buf, fsipcbuf.readRet.ret_buf, r);
  801558:	83 ec 04             	sub    $0x4,%esp
  80155b:	50                   	push   %eax
  80155c:	68 00 50 80 00       	push   $0x805000
  801561:	ff 75 0c             	pushl  0xc(%ebp)
  801564:	e8 fe f3 ff ff       	call   800967 <memmove>
	return r;
  801569:	83 c4 10             	add    $0x10,%esp
}
  80156c:	89 d8                	mov    %ebx,%eax
  80156e:	8d 65 f8             	lea    -0x8(%ebp),%esp
  801571:	5b                   	pop    %ebx
  801572:	5e                   	pop    %esi
  801573:	5d                   	pop    %ebp
  801574:	c3                   	ret    
	assert(r <= n);
  801575:	68 58 29 80 00       	push   $0x802958
  80157a:	68 5f 29 80 00       	push   $0x80295f
  80157f:	6a 7c                	push   $0x7c
  801581:	68 74 29 80 00       	push   $0x802974
  801586:	e8 66 eb ff ff       	call   8000f1 <_panic>
	assert(r <= PGSIZE);
  80158b:	68 7f 29 80 00       	push   $0x80297f
  801590:	68 5f 29 80 00       	push   $0x80295f
  801595:	6a 7d                	push   $0x7d
  801597:	68 74 29 80 00       	push   $0x802974
  80159c:	e8 50 eb ff ff       	call   8000f1 <_panic>

008015a1 <open>:
{
  8015a1:	f3 0f 1e fb          	endbr32 
  8015a5:	55                   	push   %ebp
  8015a6:	89 e5                	mov    %esp,%ebp
  8015a8:	56                   	push   %esi
  8015a9:	53                   	push   %ebx
  8015aa:	83 ec 1c             	sub    $0x1c,%esp
  8015ad:	8b 75 08             	mov    0x8(%ebp),%esi
	if (strlen(path) >= MAXPATHLEN)
  8015b0:	56                   	push   %esi
  8015b1:	e8 b8 f1 ff ff       	call   80076e <strlen>
  8015b6:	83 c4 10             	add    $0x10,%esp
  8015b9:	3d ff 03 00 00       	cmp    $0x3ff,%eax
  8015be:	7f 6c                	jg     80162c <open+0x8b>
	if ((r = fd_alloc(&fd)) < 0)
  8015c0:	83 ec 0c             	sub    $0xc,%esp
  8015c3:	8d 45 f4             	lea    -0xc(%ebp),%eax
  8015c6:	50                   	push   %eax
  8015c7:	e8 67 f8 ff ff       	call   800e33 <fd_alloc>
  8015cc:	89 c3                	mov    %eax,%ebx
  8015ce:	83 c4 10             	add    $0x10,%esp
  8015d1:	85 c0                	test   %eax,%eax
  8015d3:	78 3c                	js     801611 <open+0x70>
	strcpy(fsipcbuf.open.req_path, path);
  8015d5:	83 ec 08             	sub    $0x8,%esp
  8015d8:	56                   	push   %esi
  8015d9:	68 00 50 80 00       	push   $0x805000
  8015de:	e8 ce f1 ff ff       	call   8007b1 <strcpy>
	fsipcbuf.open.req_omode = mode;
  8015e3:	8b 45 0c             	mov    0xc(%ebp),%eax
  8015e6:	a3 00 54 80 00       	mov    %eax,0x805400
	if ((r = fsipc(FSREQ_OPEN, fd)) < 0) {
  8015eb:	8b 55 f4             	mov    -0xc(%ebp),%edx
  8015ee:	b8 01 00 00 00       	mov    $0x1,%eax
  8015f3:	e8 db fd ff ff       	call   8013d3 <fsipc>
  8015f8:	89 c3                	mov    %eax,%ebx
  8015fa:	83 c4 10             	add    $0x10,%esp
  8015fd:	85 c0                	test   %eax,%eax
  8015ff:	78 19                	js     80161a <open+0x79>
	return fd2num(fd);
  801601:	83 ec 0c             	sub    $0xc,%esp
  801604:	ff 75 f4             	pushl  -0xc(%ebp)
  801607:	e8 f8 f7 ff ff       	call   800e04 <fd2num>
  80160c:	89 c3                	mov    %eax,%ebx
  80160e:	83 c4 10             	add    $0x10,%esp
}
  801611:	89 d8                	mov    %ebx,%eax
  801613:	8d 65 f8             	lea    -0x8(%ebp),%esp
  801616:	5b                   	pop    %ebx
  801617:	5e                   	pop    %esi
  801618:	5d                   	pop    %ebp
  801619:	c3                   	ret    
		fd_close(fd, 0);
  80161a:	83 ec 08             	sub    $0x8,%esp
  80161d:	6a 00                	push   $0x0
  80161f:	ff 75 f4             	pushl  -0xc(%ebp)
  801622:	e8 10 f9 ff ff       	call   800f37 <fd_close>
		return r;
  801627:	83 c4 10             	add    $0x10,%esp
  80162a:	eb e5                	jmp    801611 <open+0x70>
		return -E_BAD_PATH;
  80162c:	bb f4 ff ff ff       	mov    $0xfffffff4,%ebx
  801631:	eb de                	jmp    801611 <open+0x70>

00801633 <sync>:


// Synchronize disk with buffer cache
int
sync(void)
{
  801633:	f3 0f 1e fb          	endbr32 
  801637:	55                   	push   %ebp
  801638:	89 e5                	mov    %esp,%ebp
  80163a:	83 ec 08             	sub    $0x8,%esp
	// Ask the file server to update the disk
	// by writing any dirty blocks in the buffer cache.

	return fsipc(FSREQ_SYNC, NULL);
  80163d:	ba 00 00 00 00       	mov    $0x0,%edx
  801642:	b8 08 00 00 00       	mov    $0x8,%eax
  801647:	e8 87 fd ff ff       	call   8013d3 <fsipc>
}
  80164c:	c9                   	leave  
  80164d:	c3                   	ret    

0080164e <spawn>:
// argv: pointer to null-terminated array of pointers to strings,
// 	 which will be passed to the child as its command-line arguments.
// Returns child envid on success, < 0 on failure.
int
spawn(const char *prog, const char **argv)
{
  80164e:	f3 0f 1e fb          	endbr32 
  801652:	55                   	push   %ebp
  801653:	89 e5                	mov    %esp,%ebp
  801655:	57                   	push   %edi
  801656:	56                   	push   %esi
  801657:	53                   	push   %ebx
  801658:	81 ec 94 02 00 00    	sub    $0x294,%esp
	//   - Call sys_env_set_trapframe(child, &child_tf) to set up the
	//     correct initial eip and esp values in the child.
	//
	//   - Start the child process running with sys_env_set_status().

	if ((r = open(prog, O_RDONLY)) < 0)
  80165e:	6a 00                	push   $0x0
  801660:	ff 75 08             	pushl  0x8(%ebp)
  801663:	e8 39 ff ff ff       	call   8015a1 <open>
  801668:	89 85 94 fd ff ff    	mov    %eax,-0x26c(%ebp)
  80166e:	83 c4 10             	add    $0x10,%esp
  801671:	85 c0                	test   %eax,%eax
  801673:	0f 88 e5 04 00 00    	js     801b5e <spawn+0x510>
  801679:	89 c1                	mov    %eax,%ecx
		return r;
	fd = r;

	// Read elf header
	elf = (struct Elf*) elf_buf;
	if (readn(fd, elf_buf, sizeof(elf_buf)) != sizeof(elf_buf)
  80167b:	83 ec 04             	sub    $0x4,%esp
  80167e:	68 00 02 00 00       	push   $0x200
  801683:	8d 85 e8 fd ff ff    	lea    -0x218(%ebp),%eax
  801689:	50                   	push   %eax
  80168a:	51                   	push   %ecx
  80168b:	e8 07 fb ff ff       	call   801197 <readn>
  801690:	83 c4 10             	add    $0x10,%esp
  801693:	3d 00 02 00 00       	cmp    $0x200,%eax
  801698:	75 7e                	jne    801718 <spawn+0xca>
	    || elf->e_magic != ELF_MAGIC) {
  80169a:	81 bd e8 fd ff ff 7f 	cmpl   $0x464c457f,-0x218(%ebp)
  8016a1:	45 4c 46 
  8016a4:	75 72                	jne    801718 <spawn+0xca>
// This must be inlined.  Exercise for reader: why?
static inline envid_t __attribute__((always_inline))
sys_exofork(void)
{
	envid_t ret;
	asm volatile("int %2"
  8016a6:	b8 07 00 00 00       	mov    $0x7,%eax
  8016ab:	cd 30                	int    $0x30
  8016ad:	89 85 74 fd ff ff    	mov    %eax,-0x28c(%ebp)
  8016b3:	89 85 88 fd ff ff    	mov    %eax,-0x278(%ebp)
		cprintf("elf magic %08x want %08x\n", elf->e_magic, ELF_MAGIC);
		return -E_NOT_EXEC;
	}

	// Create new child environment
	if ((r = sys_exofork()) < 0)
  8016b9:	85 c0                	test   %eax,%eax
  8016bb:	0f 88 91 04 00 00    	js     801b52 <spawn+0x504>
		return r;
	child = r;

	// Set up trap frame, including initial stack.
	child_tf = envs[ENVX(child)].env_tf;
  8016c1:	25 ff 03 00 00       	and    $0x3ff,%eax
  8016c6:	6b f0 7c             	imul   $0x7c,%eax,%esi
  8016c9:	81 c6 00 00 c0 ee    	add    $0xeec00000,%esi
  8016cf:	8d bd a4 fd ff ff    	lea    -0x25c(%ebp),%edi
  8016d5:	b9 11 00 00 00       	mov    $0x11,%ecx
  8016da:	f3 a5                	rep movsl %ds:(%esi),%es:(%edi)
	child_tf.tf_eip = elf->e_entry;
  8016dc:	8b 85 00 fe ff ff    	mov    -0x200(%ebp),%eax
  8016e2:	89 85 d4 fd ff ff    	mov    %eax,-0x22c(%ebp)
	uintptr_t *argv_store;

	// Count the number of arguments (argc)
	// and the total amount of space needed for strings (string_size).
	string_size = 0;
	for (argc = 0; argv[argc] != 0; argc++)
  8016e8:	bb 00 00 00 00       	mov    $0x0,%ebx
	string_size = 0;
  8016ed:	be 00 00 00 00       	mov    $0x0,%esi
  8016f2:	8b 7d 0c             	mov    0xc(%ebp),%edi
  8016f5:	8d 0c 9d 00 00 00 00 	lea    0x0(,%ebx,4),%ecx
	for (argc = 0; argv[argc] != 0; argc++)
  8016fc:	8b 04 9f             	mov    (%edi,%ebx,4),%eax
  8016ff:	85 c0                	test   %eax,%eax
  801701:	74 4d                	je     801750 <spawn+0x102>
		string_size += strlen(argv[argc]) + 1;
  801703:	83 ec 0c             	sub    $0xc,%esp
  801706:	50                   	push   %eax
  801707:	e8 62 f0 ff ff       	call   80076e <strlen>
  80170c:	8d 74 06 01          	lea    0x1(%esi,%eax,1),%esi
	for (argc = 0; argv[argc] != 0; argc++)
  801710:	83 c3 01             	add    $0x1,%ebx
  801713:	83 c4 10             	add    $0x10,%esp
  801716:	eb dd                	jmp    8016f5 <spawn+0xa7>
		close(fd);
  801718:	83 ec 0c             	sub    $0xc,%esp
  80171b:	ff b5 94 fd ff ff    	pushl  -0x26c(%ebp)
  801721:	e8 9c f8 ff ff       	call   800fc2 <close>
		cprintf("elf magic %08x want %08x\n", elf->e_magic, ELF_MAGIC);
  801726:	83 c4 0c             	add    $0xc,%esp
  801729:	68 7f 45 4c 46       	push   $0x464c457f
  80172e:	ff b5 e8 fd ff ff    	pushl  -0x218(%ebp)
  801734:	68 8b 29 80 00       	push   $0x80298b
  801739:	e8 9a ea ff ff       	call   8001d8 <cprintf>
		return -E_NOT_EXEC;
  80173e:	83 c4 10             	add    $0x10,%esp
  801741:	c7 85 94 fd ff ff f2 	movl   $0xfffffff2,-0x26c(%ebp)
  801748:	ff ff ff 
  80174b:	e9 0e 04 00 00       	jmp    801b5e <spawn+0x510>
  801750:	89 9d 84 fd ff ff    	mov    %ebx,-0x27c(%ebp)
  801756:	89 8d 80 fd ff ff    	mov    %ecx,-0x280(%ebp)
	// Determine where to place the strings and the argv array.
	// Set up pointers into the temporary page 'UTEMP'; we'll map a page
	// there later, then remap that page into the child environment
	// at (USTACKTOP - PGSIZE).
	// strings is the topmost thing on the stack.
	string_store = (char*) UTEMP + PGSIZE - string_size;
  80175c:	bf 00 10 40 00       	mov    $0x401000,%edi
  801761:	29 f7                	sub    %esi,%edi
	// argv is below that.  There's one argument pointer per argument, plus
	// a null pointer.
	argv_store = (uintptr_t*) (ROUNDDOWN(string_store, 4) - 4 * (argc + 1));
  801763:	89 fa                	mov    %edi,%edx
  801765:	83 e2 fc             	and    $0xfffffffc,%edx
  801768:	8d 04 9d 04 00 00 00 	lea    0x4(,%ebx,4),%eax
  80176f:	29 c2                	sub    %eax,%edx
  801771:	89 95 90 fd ff ff    	mov    %edx,-0x270(%ebp)

	// Make sure that argv, strings, and the 2 words that hold 'argc'
	// and 'argv' themselves will all fit in a single stack page.
	if ((void*) (argv_store - 2) < (void*) UTEMP)
  801777:	8d 42 f8             	lea    -0x8(%edx),%eax
  80177a:	3d ff ff 3f 00       	cmp    $0x3fffff,%eax
  80177f:	0f 86 fc 03 00 00    	jbe    801b81 <spawn+0x533>
		return -E_NO_MEM;

	// Allocate the single stack page at UTEMP.
	if ((r = sys_page_alloc(0, (void*) UTEMP, PTE_P|PTE_U|PTE_W)) < 0)
  801785:	83 ec 04             	sub    $0x4,%esp
  801788:	6a 07                	push   $0x7
  80178a:	68 00 00 40 00       	push   $0x400000
  80178f:	6a 00                	push   $0x0
  801791:	e8 5d f4 ff ff       	call   800bf3 <sys_page_alloc>
  801796:	83 c4 10             	add    $0x10,%esp
  801799:	85 c0                	test   %eax,%eax
  80179b:	0f 88 e5 03 00 00    	js     801b86 <spawn+0x538>
	//	  (Again, argv should use an address valid in the child's
	//	  environment.)
	//
	//	* Set *init_esp to the initial stack pointer for the child,
	//	  (Again, use an address valid in the child's environment.)
	for (i = 0; i < argc; i++) {
  8017a1:	be 00 00 00 00       	mov    $0x0,%esi
  8017a6:	89 9d 8c fd ff ff    	mov    %ebx,-0x274(%ebp)
  8017ac:	8b 5d 0c             	mov    0xc(%ebp),%ebx
  8017af:	eb 30                	jmp    8017e1 <spawn+0x193>
		argv_store[i] = UTEMP2USTACK(string_store);
  8017b1:	8d 87 00 d0 7f ee    	lea    -0x11803000(%edi),%eax
  8017b7:	8b 8d 90 fd ff ff    	mov    -0x270(%ebp),%ecx
  8017bd:	89 04 b1             	mov    %eax,(%ecx,%esi,4)
		strcpy(string_store, argv[i]);
  8017c0:	83 ec 08             	sub    $0x8,%esp
  8017c3:	ff 34 b3             	pushl  (%ebx,%esi,4)
  8017c6:	57                   	push   %edi
  8017c7:	e8 e5 ef ff ff       	call   8007b1 <strcpy>
		string_store += strlen(argv[i]) + 1;
  8017cc:	83 c4 04             	add    $0x4,%esp
  8017cf:	ff 34 b3             	pushl  (%ebx,%esi,4)
  8017d2:	e8 97 ef ff ff       	call   80076e <strlen>
  8017d7:	8d 7c 07 01          	lea    0x1(%edi,%eax,1),%edi
	for (i = 0; i < argc; i++) {
  8017db:	83 c6 01             	add    $0x1,%esi
  8017de:	83 c4 10             	add    $0x10,%esp
  8017e1:	39 b5 8c fd ff ff    	cmp    %esi,-0x274(%ebp)
  8017e7:	7f c8                	jg     8017b1 <spawn+0x163>
	}
	argv_store[argc] = 0;
  8017e9:	8b 85 90 fd ff ff    	mov    -0x270(%ebp),%eax
  8017ef:	8b 8d 80 fd ff ff    	mov    -0x280(%ebp),%ecx
  8017f5:	c7 04 08 00 00 00 00 	movl   $0x0,(%eax,%ecx,1)
	assert(string_store == (char*)UTEMP + PGSIZE);
  8017fc:	81 ff 00 10 40 00    	cmp    $0x401000,%edi
  801802:	0f 85 86 00 00 00    	jne    80188e <spawn+0x240>

	argv_store[-1] = UTEMP2USTACK(argv_store);
  801808:	8b 95 90 fd ff ff    	mov    -0x270(%ebp),%edx
  80180e:	8d 82 00 d0 7f ee    	lea    -0x11803000(%edx),%eax
  801814:	89 42 fc             	mov    %eax,-0x4(%edx)
	argv_store[-2] = argc;
  801817:	89 d0                	mov    %edx,%eax
  801819:	8b 8d 84 fd ff ff    	mov    -0x27c(%ebp),%ecx
  80181f:	89 4a f8             	mov    %ecx,-0x8(%edx)

	*init_esp = UTEMP2USTACK(&argv_store[-2]);
  801822:	2d 08 30 80 11       	sub    $0x11803008,%eax
  801827:	89 85 e0 fd ff ff    	mov    %eax,-0x220(%ebp)

	// After completing the stack, map it into the child's address space
	// and unmap it from ours!
	if ((r = sys_page_map(0, UTEMP, child, (void*) (USTACKTOP - PGSIZE), PTE_P | PTE_U | PTE_W)) < 0)
  80182d:	83 ec 0c             	sub    $0xc,%esp
  801830:	6a 07                	push   $0x7
  801832:	68 00 d0 bf ee       	push   $0xeebfd000
  801837:	ff b5 74 fd ff ff    	pushl  -0x28c(%ebp)
  80183d:	68 00 00 40 00       	push   $0x400000
  801842:	6a 00                	push   $0x0
  801844:	e8 f1 f3 ff ff       	call   800c3a <sys_page_map>
  801849:	89 c3                	mov    %eax,%ebx
  80184b:	83 c4 20             	add    $0x20,%esp
  80184e:	85 c0                	test   %eax,%eax
  801850:	0f 88 38 03 00 00    	js     801b8e <spawn+0x540>
		goto error;
	if ((r = sys_page_unmap(0, UTEMP)) < 0)
  801856:	83 ec 08             	sub    $0x8,%esp
  801859:	68 00 00 40 00       	push   $0x400000
  80185e:	6a 00                	push   $0x0
  801860:	e8 1b f4 ff ff       	call   800c80 <sys_page_unmap>
  801865:	89 c3                	mov    %eax,%ebx
  801867:	83 c4 10             	add    $0x10,%esp
  80186a:	85 c0                	test   %eax,%eax
  80186c:	0f 88 1c 03 00 00    	js     801b8e <spawn+0x540>
	ph = (struct Proghdr*) (elf_buf + elf->e_phoff);
  801872:	8b 85 04 fe ff ff    	mov    -0x1fc(%ebp),%eax
  801878:	8d b4 05 e8 fd ff ff 	lea    -0x218(%ebp,%eax,1),%esi
	for (i = 0; i < elf->e_phnum; i++, ph++) {
  80187f:	c7 85 84 fd ff ff 00 	movl   $0x0,-0x27c(%ebp)
  801886:	00 00 00 
  801889:	e9 4f 01 00 00       	jmp    8019dd <spawn+0x38f>
	assert(string_store == (char*)UTEMP + PGSIZE);
  80188e:	68 00 2a 80 00       	push   $0x802a00
  801893:	68 5f 29 80 00       	push   $0x80295f
  801898:	68 f2 00 00 00       	push   $0xf2
  80189d:	68 a5 29 80 00       	push   $0x8029a5
  8018a2:	e8 4a e8 ff ff       	call   8000f1 <_panic>
			// allocate a blank page
			if ((r = sys_page_alloc(child, (void*) (va + i), perm)) < 0)
				return r;
		} else {
			// from file
			if ((r = sys_page_alloc(0, UTEMP, PTE_P|PTE_U|PTE_W)) < 0)
  8018a7:	83 ec 04             	sub    $0x4,%esp
  8018aa:	6a 07                	push   $0x7
  8018ac:	68 00 00 40 00       	push   $0x400000
  8018b1:	6a 00                	push   $0x0
  8018b3:	e8 3b f3 ff ff       	call   800bf3 <sys_page_alloc>
  8018b8:	83 c4 10             	add    $0x10,%esp
  8018bb:	85 c0                	test   %eax,%eax
  8018bd:	0f 88 a9 02 00 00    	js     801b6c <spawn+0x51e>
				return r;
			if ((r = seek(fd, fileoffset + i)) < 0)
  8018c3:	83 ec 08             	sub    $0x8,%esp
  8018c6:	8b 85 80 fd ff ff    	mov    -0x280(%ebp),%eax
  8018cc:	01 f0                	add    %esi,%eax
  8018ce:	50                   	push   %eax
  8018cf:	ff b5 94 fd ff ff    	pushl  -0x26c(%ebp)
  8018d5:	e8 8e f9 ff ff       	call   801268 <seek>
  8018da:	83 c4 10             	add    $0x10,%esp
  8018dd:	85 c0                	test   %eax,%eax
  8018df:	0f 88 8e 02 00 00    	js     801b73 <spawn+0x525>
				return r;
			if ((r = readn(fd, UTEMP, MIN(PGSIZE, filesz-i))) < 0)
  8018e5:	83 ec 04             	sub    $0x4,%esp
  8018e8:	8b 85 90 fd ff ff    	mov    -0x270(%ebp),%eax
  8018ee:	29 f0                	sub    %esi,%eax
  8018f0:	3d 00 10 00 00       	cmp    $0x1000,%eax
  8018f5:	b9 00 10 00 00       	mov    $0x1000,%ecx
  8018fa:	0f 47 c1             	cmova  %ecx,%eax
  8018fd:	50                   	push   %eax
  8018fe:	68 00 00 40 00       	push   $0x400000
  801903:	ff b5 94 fd ff ff    	pushl  -0x26c(%ebp)
  801909:	e8 89 f8 ff ff       	call   801197 <readn>
  80190e:	83 c4 10             	add    $0x10,%esp
  801911:	85 c0                	test   %eax,%eax
  801913:	0f 88 61 02 00 00    	js     801b7a <spawn+0x52c>
				return r;
			if ((r = sys_page_map(0, UTEMP, child, (void*) (va + i), perm)) < 0)
  801919:	83 ec 0c             	sub    $0xc,%esp
  80191c:	ff b5 8c fd ff ff    	pushl  -0x274(%ebp)
  801922:	53                   	push   %ebx
  801923:	ff b5 88 fd ff ff    	pushl  -0x278(%ebp)
  801929:	68 00 00 40 00       	push   $0x400000
  80192e:	6a 00                	push   $0x0
  801930:	e8 05 f3 ff ff       	call   800c3a <sys_page_map>
  801935:	83 c4 20             	add    $0x20,%esp
  801938:	85 c0                	test   %eax,%eax
  80193a:	78 7c                	js     8019b8 <spawn+0x36a>
				panic("spawn: sys_page_map data: %e", r);
			sys_page_unmap(0, UTEMP);
  80193c:	83 ec 08             	sub    $0x8,%esp
  80193f:	68 00 00 40 00       	push   $0x400000
  801944:	6a 00                	push   $0x0
  801946:	e8 35 f3 ff ff       	call   800c80 <sys_page_unmap>
  80194b:	83 c4 10             	add    $0x10,%esp
	for (i = 0; i < memsz; i += PGSIZE) {
  80194e:	81 c7 00 10 00 00    	add    $0x1000,%edi
  801954:	81 c3 00 10 00 00    	add    $0x1000,%ebx
  80195a:	89 fe                	mov    %edi,%esi
  80195c:	39 bd 7c fd ff ff    	cmp    %edi,-0x284(%ebp)
  801962:	76 69                	jbe    8019cd <spawn+0x37f>
		if (i >= filesz) {
  801964:	39 bd 90 fd ff ff    	cmp    %edi,-0x270(%ebp)
  80196a:	0f 87 37 ff ff ff    	ja     8018a7 <spawn+0x259>
			if ((r = sys_page_alloc(child, (void*) (va + i), perm)) < 0)
  801970:	83 ec 04             	sub    $0x4,%esp
  801973:	ff b5 8c fd ff ff    	pushl  -0x274(%ebp)
  801979:	53                   	push   %ebx
  80197a:	ff b5 88 fd ff ff    	pushl  -0x278(%ebp)
  801980:	e8 6e f2 ff ff       	call   800bf3 <sys_page_alloc>
  801985:	83 c4 10             	add    $0x10,%esp
  801988:	85 c0                	test   %eax,%eax
  80198a:	79 c2                	jns    80194e <spawn+0x300>
  80198c:	89 c7                	mov    %eax,%edi
	sys_env_destroy(child);
  80198e:	83 ec 0c             	sub    $0xc,%esp
  801991:	ff b5 74 fd ff ff    	pushl  -0x28c(%ebp)
  801997:	e8 cc f1 ff ff       	call   800b68 <sys_env_destroy>
	close(fd);
  80199c:	83 c4 04             	add    $0x4,%esp
  80199f:	ff b5 94 fd ff ff    	pushl  -0x26c(%ebp)
  8019a5:	e8 18 f6 ff ff       	call   800fc2 <close>
	return r;
  8019aa:	83 c4 10             	add    $0x10,%esp
  8019ad:	89 bd 94 fd ff ff    	mov    %edi,-0x26c(%ebp)
  8019b3:	e9 a6 01 00 00       	jmp    801b5e <spawn+0x510>
				panic("spawn: sys_page_map data: %e", r);
  8019b8:	50                   	push   %eax
  8019b9:	68 b1 29 80 00       	push   $0x8029b1
  8019be:	68 25 01 00 00       	push   $0x125
  8019c3:	68 a5 29 80 00       	push   $0x8029a5
  8019c8:	e8 24 e7 ff ff       	call   8000f1 <_panic>
  8019cd:	8b b5 78 fd ff ff    	mov    -0x288(%ebp),%esi
	for (i = 0; i < elf->e_phnum; i++, ph++) {
  8019d3:	83 85 84 fd ff ff 01 	addl   $0x1,-0x27c(%ebp)
  8019da:	83 c6 20             	add    $0x20,%esi
  8019dd:	0f b7 85 14 fe ff ff 	movzwl -0x1ec(%ebp),%eax
  8019e4:	3b 85 84 fd ff ff    	cmp    -0x27c(%ebp),%eax
  8019ea:	7e 6d                	jle    801a59 <spawn+0x40b>
		if (ph->p_type != ELF_PROG_LOAD)
  8019ec:	83 3e 01             	cmpl   $0x1,(%esi)
  8019ef:	75 e2                	jne    8019d3 <spawn+0x385>
		if (ph->p_flags & ELF_PROG_FLAG_WRITE)
  8019f1:	8b 46 18             	mov    0x18(%esi),%eax
  8019f4:	83 e0 02             	and    $0x2,%eax
			perm |= PTE_W;
  8019f7:	83 f8 01             	cmp    $0x1,%eax
  8019fa:	19 c0                	sbb    %eax,%eax
  8019fc:	83 e0 fe             	and    $0xfffffffe,%eax
  8019ff:	83 c0 07             	add    $0x7,%eax
  801a02:	89 85 8c fd ff ff    	mov    %eax,-0x274(%ebp)
		if ((r = map_segment(child, ph->p_va, ph->p_memsz,
  801a08:	8b 4e 04             	mov    0x4(%esi),%ecx
  801a0b:	89 8d 80 fd ff ff    	mov    %ecx,-0x280(%ebp)
  801a11:	8b 56 10             	mov    0x10(%esi),%edx
  801a14:	89 95 90 fd ff ff    	mov    %edx,-0x270(%ebp)
  801a1a:	8b 7e 14             	mov    0x14(%esi),%edi
  801a1d:	89 bd 7c fd ff ff    	mov    %edi,-0x284(%ebp)
  801a23:	8b 5e 08             	mov    0x8(%esi),%ebx
	if ((i = PGOFF(va))) {
  801a26:	89 d8                	mov    %ebx,%eax
  801a28:	25 ff 0f 00 00       	and    $0xfff,%eax
  801a2d:	74 1a                	je     801a49 <spawn+0x3fb>
		va -= i;
  801a2f:	29 c3                	sub    %eax,%ebx
		memsz += i;
  801a31:	01 c7                	add    %eax,%edi
  801a33:	89 bd 7c fd ff ff    	mov    %edi,-0x284(%ebp)
		filesz += i;
  801a39:	01 c2                	add    %eax,%edx
  801a3b:	89 95 90 fd ff ff    	mov    %edx,-0x270(%ebp)
		fileoffset -= i;
  801a41:	29 c1                	sub    %eax,%ecx
  801a43:	89 8d 80 fd ff ff    	mov    %ecx,-0x280(%ebp)
	for (i = 0; i < memsz; i += PGSIZE) {
  801a49:	bf 00 00 00 00       	mov    $0x0,%edi
  801a4e:	89 b5 78 fd ff ff    	mov    %esi,-0x288(%ebp)
  801a54:	e9 01 ff ff ff       	jmp    80195a <spawn+0x30c>
	close(fd);
  801a59:	83 ec 0c             	sub    $0xc,%esp
  801a5c:	ff b5 94 fd ff ff    	pushl  -0x26c(%ebp)
  801a62:	e8 5b f5 ff ff       	call   800fc2 <close>
  801a67:	83 c4 10             	add    $0x10,%esp
static int
copy_shared_pages(envid_t child)
{
	// LAB 5: Your code here.
	uintptr_t addr;
	for (addr = 0; addr < UTOP; addr += PGSIZE) {
  801a6a:	bb 00 00 00 00       	mov    $0x0,%ebx
  801a6f:	8b b5 88 fd ff ff    	mov    -0x278(%ebp),%esi
  801a75:	eb 2b                	jmp    801aa2 <spawn+0x454>
		if ((uvpd[PDX(addr)] & PTE_P) && (uvpt[PGNUM(addr)] & PTE_P) &&
				(uvpt[PGNUM(addr)] & PTE_U) && (uvpt[PGNUM(addr)] & PTE_SHARE)) {
            sys_page_map(0, (void*)addr, child, (void*)addr, (uvpt[PGNUM(addr)] & PTE_SYSCALL));
  801a77:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
  801a7e:	83 ec 0c             	sub    $0xc,%esp
  801a81:	25 07 0e 00 00       	and    $0xe07,%eax
  801a86:	50                   	push   %eax
  801a87:	53                   	push   %ebx
  801a88:	56                   	push   %esi
  801a89:	53                   	push   %ebx
  801a8a:	6a 00                	push   $0x0
  801a8c:	e8 a9 f1 ff ff       	call   800c3a <sys_page_map>
  801a91:	83 c4 20             	add    $0x20,%esp
	for (addr = 0; addr < UTOP; addr += PGSIZE) {
  801a94:	81 c3 00 10 00 00    	add    $0x1000,%ebx
  801a9a:	81 fb 00 00 c0 ee    	cmp    $0xeec00000,%ebx
  801aa0:	74 3b                	je     801add <spawn+0x48f>
		if ((uvpd[PDX(addr)] & PTE_P) && (uvpt[PGNUM(addr)] & PTE_P) &&
  801aa2:	89 d8                	mov    %ebx,%eax
  801aa4:	c1 e8 16             	shr    $0x16,%eax
  801aa7:	8b 04 85 00 d0 7b ef 	mov    -0x10843000(,%eax,4),%eax
  801aae:	a8 01                	test   $0x1,%al
  801ab0:	74 e2                	je     801a94 <spawn+0x446>
  801ab2:	89 d8                	mov    %ebx,%eax
  801ab4:	c1 e8 0c             	shr    $0xc,%eax
  801ab7:	8b 14 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%edx
  801abe:	f6 c2 01             	test   $0x1,%dl
  801ac1:	74 d1                	je     801a94 <spawn+0x446>
				(uvpt[PGNUM(addr)] & PTE_U) && (uvpt[PGNUM(addr)] & PTE_SHARE)) {
  801ac3:	8b 14 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%edx
		if ((uvpd[PDX(addr)] & PTE_P) && (uvpt[PGNUM(addr)] & PTE_P) &&
  801aca:	f6 c2 04             	test   $0x4,%dl
  801acd:	74 c5                	je     801a94 <spawn+0x446>
				(uvpt[PGNUM(addr)] & PTE_U) && (uvpt[PGNUM(addr)] & PTE_SHARE)) {
  801acf:	8b 14 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%edx
  801ad6:	f6 c6 04             	test   $0x4,%dh
  801ad9:	74 b9                	je     801a94 <spawn+0x446>
  801adb:	eb 9a                	jmp    801a77 <spawn+0x429>
	child_tf.tf_eflags |= FL_IOPL_3;   // devious: see user/faultio.c
  801add:	81 8d dc fd ff ff 00 	orl    $0x3000,-0x224(%ebp)
  801ae4:	30 00 00 
	if ((r = sys_env_set_trapframe(child, &child_tf)) < 0)
  801ae7:	83 ec 08             	sub    $0x8,%esp
  801aea:	8d 85 a4 fd ff ff    	lea    -0x25c(%ebp),%eax
  801af0:	50                   	push   %eax
  801af1:	ff b5 74 fd ff ff    	pushl  -0x28c(%ebp)
  801af7:	e8 10 f2 ff ff       	call   800d0c <sys_env_set_trapframe>
  801afc:	83 c4 10             	add    $0x10,%esp
  801aff:	85 c0                	test   %eax,%eax
  801b01:	78 25                	js     801b28 <spawn+0x4da>
	if ((r = sys_env_set_status(child, ENV_RUNNABLE)) < 0)
  801b03:	83 ec 08             	sub    $0x8,%esp
  801b06:	6a 02                	push   $0x2
  801b08:	ff b5 74 fd ff ff    	pushl  -0x28c(%ebp)
  801b0e:	e8 b3 f1 ff ff       	call   800cc6 <sys_env_set_status>
  801b13:	83 c4 10             	add    $0x10,%esp
  801b16:	85 c0                	test   %eax,%eax
  801b18:	78 23                	js     801b3d <spawn+0x4ef>
	return child;
  801b1a:	8b 85 74 fd ff ff    	mov    -0x28c(%ebp),%eax
  801b20:	89 85 94 fd ff ff    	mov    %eax,-0x26c(%ebp)
  801b26:	eb 36                	jmp    801b5e <spawn+0x510>
		panic("sys_env_set_trapframe: %e", r);
  801b28:	50                   	push   %eax
  801b29:	68 ce 29 80 00       	push   $0x8029ce
  801b2e:	68 86 00 00 00       	push   $0x86
  801b33:	68 a5 29 80 00       	push   $0x8029a5
  801b38:	e8 b4 e5 ff ff       	call   8000f1 <_panic>
		panic("sys_env_set_status: %e", r);
  801b3d:	50                   	push   %eax
  801b3e:	68 e8 29 80 00       	push   $0x8029e8
  801b43:	68 89 00 00 00       	push   $0x89
  801b48:	68 a5 29 80 00       	push   $0x8029a5
  801b4d:	e8 9f e5 ff ff       	call   8000f1 <_panic>
		return r;
  801b52:	8b 85 74 fd ff ff    	mov    -0x28c(%ebp),%eax
  801b58:	89 85 94 fd ff ff    	mov    %eax,-0x26c(%ebp)
}
  801b5e:	8b 85 94 fd ff ff    	mov    -0x26c(%ebp),%eax
  801b64:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801b67:	5b                   	pop    %ebx
  801b68:	5e                   	pop    %esi
  801b69:	5f                   	pop    %edi
  801b6a:	5d                   	pop    %ebp
  801b6b:	c3                   	ret    
  801b6c:	89 c7                	mov    %eax,%edi
  801b6e:	e9 1b fe ff ff       	jmp    80198e <spawn+0x340>
  801b73:	89 c7                	mov    %eax,%edi
  801b75:	e9 14 fe ff ff       	jmp    80198e <spawn+0x340>
  801b7a:	89 c7                	mov    %eax,%edi
  801b7c:	e9 0d fe ff ff       	jmp    80198e <spawn+0x340>
		return -E_NO_MEM;
  801b81:	b8 fc ff ff ff       	mov    $0xfffffffc,%eax
	for (addr = 0; addr < UTOP; addr += PGSIZE) {
  801b86:	89 85 94 fd ff ff    	mov    %eax,-0x26c(%ebp)
  801b8c:	eb d0                	jmp    801b5e <spawn+0x510>
	sys_page_unmap(0, UTEMP);
  801b8e:	83 ec 08             	sub    $0x8,%esp
  801b91:	68 00 00 40 00       	push   $0x400000
  801b96:	6a 00                	push   $0x0
  801b98:	e8 e3 f0 ff ff       	call   800c80 <sys_page_unmap>
  801b9d:	83 c4 10             	add    $0x10,%esp
  801ba0:	89 9d 94 fd ff ff    	mov    %ebx,-0x26c(%ebp)
  801ba6:	eb b6                	jmp    801b5e <spawn+0x510>

00801ba8 <spawnl>:
{
  801ba8:	f3 0f 1e fb          	endbr32 
  801bac:	55                   	push   %ebp
  801bad:	89 e5                	mov    %esp,%ebp
  801baf:	57                   	push   %edi
  801bb0:	56                   	push   %esi
  801bb1:	53                   	push   %ebx
  801bb2:	83 ec 0c             	sub    $0xc,%esp
	va_start(vl, arg0);
  801bb5:	8d 55 10             	lea    0x10(%ebp),%edx
	int argc=0;
  801bb8:	b8 00 00 00 00       	mov    $0x0,%eax
	while(va_arg(vl, void *) != NULL)
  801bbd:	8d 4a 04             	lea    0x4(%edx),%ecx
  801bc0:	83 3a 00             	cmpl   $0x0,(%edx)
  801bc3:	74 07                	je     801bcc <spawnl+0x24>
		argc++;
  801bc5:	83 c0 01             	add    $0x1,%eax
	while(va_arg(vl, void *) != NULL)
  801bc8:	89 ca                	mov    %ecx,%edx
  801bca:	eb f1                	jmp    801bbd <spawnl+0x15>
	const char *argv[argc+2];
  801bcc:	8d 14 85 17 00 00 00 	lea    0x17(,%eax,4),%edx
  801bd3:	89 d1                	mov    %edx,%ecx
  801bd5:	83 e1 f0             	and    $0xfffffff0,%ecx
  801bd8:	81 e2 00 f0 ff ff    	and    $0xfffff000,%edx
  801bde:	89 e6                	mov    %esp,%esi
  801be0:	29 d6                	sub    %edx,%esi
  801be2:	89 f2                	mov    %esi,%edx
  801be4:	39 d4                	cmp    %edx,%esp
  801be6:	74 10                	je     801bf8 <spawnl+0x50>
  801be8:	81 ec 00 10 00 00    	sub    $0x1000,%esp
  801bee:	83 8c 24 fc 0f 00 00 	orl    $0x0,0xffc(%esp)
  801bf5:	00 
  801bf6:	eb ec                	jmp    801be4 <spawnl+0x3c>
  801bf8:	89 ca                	mov    %ecx,%edx
  801bfa:	81 e2 ff 0f 00 00    	and    $0xfff,%edx
  801c00:	29 d4                	sub    %edx,%esp
  801c02:	85 d2                	test   %edx,%edx
  801c04:	74 05                	je     801c0b <spawnl+0x63>
  801c06:	83 4c 14 fc 00       	orl    $0x0,-0x4(%esp,%edx,1)
  801c0b:	8d 74 24 03          	lea    0x3(%esp),%esi
  801c0f:	89 f2                	mov    %esi,%edx
  801c11:	c1 ea 02             	shr    $0x2,%edx
  801c14:	83 e6 fc             	and    $0xfffffffc,%esi
  801c17:	89 f3                	mov    %esi,%ebx
	argv[0] = arg0;
  801c19:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  801c1c:	89 0c 95 00 00 00 00 	mov    %ecx,0x0(,%edx,4)
	argv[argc+1] = NULL;
  801c23:	c7 44 86 04 00 00 00 	movl   $0x0,0x4(%esi,%eax,4)
  801c2a:	00 
	va_start(vl, arg0);
  801c2b:	8d 4d 10             	lea    0x10(%ebp),%ecx
  801c2e:	89 c2                	mov    %eax,%edx
	for(i=0;i<argc;i++)
  801c30:	b8 00 00 00 00       	mov    $0x0,%eax
  801c35:	eb 0b                	jmp    801c42 <spawnl+0x9a>
		argv[i+1] = va_arg(vl, const char *);
  801c37:	83 c0 01             	add    $0x1,%eax
  801c3a:	8b 39                	mov    (%ecx),%edi
  801c3c:	89 3c 83             	mov    %edi,(%ebx,%eax,4)
  801c3f:	8d 49 04             	lea    0x4(%ecx),%ecx
	for(i=0;i<argc;i++)
  801c42:	39 d0                	cmp    %edx,%eax
  801c44:	75 f1                	jne    801c37 <spawnl+0x8f>
	return spawn(prog, argv);
  801c46:	83 ec 08             	sub    $0x8,%esp
  801c49:	56                   	push   %esi
  801c4a:	ff 75 08             	pushl  0x8(%ebp)
  801c4d:	e8 fc f9 ff ff       	call   80164e <spawn>
}
  801c52:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801c55:	5b                   	pop    %ebx
  801c56:	5e                   	pop    %esi
  801c57:	5f                   	pop    %edi
  801c58:	5d                   	pop    %ebp
  801c59:	c3                   	ret    

00801c5a <devpipe_stat>:
	return i;
}

static int
devpipe_stat(struct Fd *fd, struct Stat *stat)
{
  801c5a:	f3 0f 1e fb          	endbr32 
  801c5e:	55                   	push   %ebp
  801c5f:	89 e5                	mov    %esp,%ebp
  801c61:	56                   	push   %esi
  801c62:	53                   	push   %ebx
  801c63:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	struct Pipe *p = (struct Pipe*) fd2data(fd);
  801c66:	83 ec 0c             	sub    $0xc,%esp
  801c69:	ff 75 08             	pushl  0x8(%ebp)
  801c6c:	e8 a7 f1 ff ff       	call   800e18 <fd2data>
  801c71:	89 c6                	mov    %eax,%esi
	strcpy(stat->st_name, "<pipe>");
  801c73:	83 c4 08             	add    $0x8,%esp
  801c76:	68 26 2a 80 00       	push   $0x802a26
  801c7b:	53                   	push   %ebx
  801c7c:	e8 30 eb ff ff       	call   8007b1 <strcpy>
	stat->st_size = p->p_wpos - p->p_rpos;
  801c81:	8b 46 04             	mov    0x4(%esi),%eax
  801c84:	2b 06                	sub    (%esi),%eax
  801c86:	89 83 80 00 00 00    	mov    %eax,0x80(%ebx)
	stat->st_isdir = 0;
  801c8c:	c7 83 84 00 00 00 00 	movl   $0x0,0x84(%ebx)
  801c93:	00 00 00 
	stat->st_dev = &devpipe;
  801c96:	c7 83 88 00 00 00 20 	movl   $0x803020,0x88(%ebx)
  801c9d:	30 80 00 
	return 0;
}
  801ca0:	b8 00 00 00 00       	mov    $0x0,%eax
  801ca5:	8d 65 f8             	lea    -0x8(%ebp),%esp
  801ca8:	5b                   	pop    %ebx
  801ca9:	5e                   	pop    %esi
  801caa:	5d                   	pop    %ebp
  801cab:	c3                   	ret    

00801cac <devpipe_close>:

static int
devpipe_close(struct Fd *fd)
{
  801cac:	f3 0f 1e fb          	endbr32 
  801cb0:	55                   	push   %ebp
  801cb1:	89 e5                	mov    %esp,%ebp
  801cb3:	53                   	push   %ebx
  801cb4:	83 ec 0c             	sub    $0xc,%esp
  801cb7:	8b 5d 08             	mov    0x8(%ebp),%ebx
	(void) sys_page_unmap(0, fd);
  801cba:	53                   	push   %ebx
  801cbb:	6a 00                	push   $0x0
  801cbd:	e8 be ef ff ff       	call   800c80 <sys_page_unmap>
	return sys_page_unmap(0, fd2data(fd));
  801cc2:	89 1c 24             	mov    %ebx,(%esp)
  801cc5:	e8 4e f1 ff ff       	call   800e18 <fd2data>
  801cca:	83 c4 08             	add    $0x8,%esp
  801ccd:	50                   	push   %eax
  801cce:	6a 00                	push   $0x0
  801cd0:	e8 ab ef ff ff       	call   800c80 <sys_page_unmap>
}
  801cd5:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  801cd8:	c9                   	leave  
  801cd9:	c3                   	ret    

00801cda <_pipeisclosed>:
{
  801cda:	55                   	push   %ebp
  801cdb:	89 e5                	mov    %esp,%ebp
  801cdd:	57                   	push   %edi
  801cde:	56                   	push   %esi
  801cdf:	53                   	push   %ebx
  801ce0:	83 ec 1c             	sub    $0x1c,%esp
  801ce3:	89 c7                	mov    %eax,%edi
  801ce5:	89 d6                	mov    %edx,%esi
		n = thisenv->env_runs;
  801ce7:	a1 04 40 80 00       	mov    0x804004,%eax
  801cec:	8b 58 58             	mov    0x58(%eax),%ebx
		ret = pageref(fd) == pageref(p);
  801cef:	83 ec 0c             	sub    $0xc,%esp
  801cf2:	57                   	push   %edi
  801cf3:	e8 73 05 00 00       	call   80226b <pageref>
  801cf8:	89 45 e4             	mov    %eax,-0x1c(%ebp)
  801cfb:	89 34 24             	mov    %esi,(%esp)
  801cfe:	e8 68 05 00 00       	call   80226b <pageref>
		nn = thisenv->env_runs;
  801d03:	8b 15 04 40 80 00    	mov    0x804004,%edx
  801d09:	8b 4a 58             	mov    0x58(%edx),%ecx
		if (n == nn)
  801d0c:	83 c4 10             	add    $0x10,%esp
  801d0f:	39 cb                	cmp    %ecx,%ebx
  801d11:	74 1b                	je     801d2e <_pipeisclosed+0x54>
		if (n != nn && ret == 1)
  801d13:	39 45 e4             	cmp    %eax,-0x1c(%ebp)
  801d16:	75 cf                	jne    801ce7 <_pipeisclosed+0xd>
			cprintf("pipe race avoided\n", n, thisenv->env_runs, ret);
  801d18:	8b 42 58             	mov    0x58(%edx),%eax
  801d1b:	6a 01                	push   $0x1
  801d1d:	50                   	push   %eax
  801d1e:	53                   	push   %ebx
  801d1f:	68 2d 2a 80 00       	push   $0x802a2d
  801d24:	e8 af e4 ff ff       	call   8001d8 <cprintf>
  801d29:	83 c4 10             	add    $0x10,%esp
  801d2c:	eb b9                	jmp    801ce7 <_pipeisclosed+0xd>
		ret = pageref(fd) == pageref(p);
  801d2e:	39 45 e4             	cmp    %eax,-0x1c(%ebp)
  801d31:	0f 94 c0             	sete   %al
  801d34:	0f b6 c0             	movzbl %al,%eax
}
  801d37:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801d3a:	5b                   	pop    %ebx
  801d3b:	5e                   	pop    %esi
  801d3c:	5f                   	pop    %edi
  801d3d:	5d                   	pop    %ebp
  801d3e:	c3                   	ret    

00801d3f <devpipe_write>:
{
  801d3f:	f3 0f 1e fb          	endbr32 
  801d43:	55                   	push   %ebp
  801d44:	89 e5                	mov    %esp,%ebp
  801d46:	57                   	push   %edi
  801d47:	56                   	push   %esi
  801d48:	53                   	push   %ebx
  801d49:	83 ec 28             	sub    $0x28,%esp
  801d4c:	8b 75 08             	mov    0x8(%ebp),%esi
	p = (struct Pipe*) fd2data(fd);
  801d4f:	56                   	push   %esi
  801d50:	e8 c3 f0 ff ff       	call   800e18 <fd2data>
  801d55:	89 c3                	mov    %eax,%ebx
	for (i = 0; i < n; i++) {
  801d57:	83 c4 10             	add    $0x10,%esp
  801d5a:	bf 00 00 00 00       	mov    $0x0,%edi
  801d5f:	3b 7d 10             	cmp    0x10(%ebp),%edi
  801d62:	74 4f                	je     801db3 <devpipe_write+0x74>
		while (p->p_wpos >= p->p_rpos + sizeof(p->p_buf)) {
  801d64:	8b 43 04             	mov    0x4(%ebx),%eax
  801d67:	8b 0b                	mov    (%ebx),%ecx
  801d69:	8d 51 20             	lea    0x20(%ecx),%edx
  801d6c:	39 d0                	cmp    %edx,%eax
  801d6e:	72 14                	jb     801d84 <devpipe_write+0x45>
			if (_pipeisclosed(fd, p))
  801d70:	89 da                	mov    %ebx,%edx
  801d72:	89 f0                	mov    %esi,%eax
  801d74:	e8 61 ff ff ff       	call   801cda <_pipeisclosed>
  801d79:	85 c0                	test   %eax,%eax
  801d7b:	75 3b                	jne    801db8 <devpipe_write+0x79>
			sys_yield();
  801d7d:	e8 4e ee ff ff       	call   800bd0 <sys_yield>
  801d82:	eb e0                	jmp    801d64 <devpipe_write+0x25>
		p->p_buf[p->p_wpos % PIPEBUFSIZ] = buf[i];
  801d84:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  801d87:	0f b6 0c 39          	movzbl (%ecx,%edi,1),%ecx
  801d8b:	88 4d e7             	mov    %cl,-0x19(%ebp)
  801d8e:	89 c2                	mov    %eax,%edx
  801d90:	c1 fa 1f             	sar    $0x1f,%edx
  801d93:	89 d1                	mov    %edx,%ecx
  801d95:	c1 e9 1b             	shr    $0x1b,%ecx
  801d98:	8d 14 08             	lea    (%eax,%ecx,1),%edx
  801d9b:	83 e2 1f             	and    $0x1f,%edx
  801d9e:	29 ca                	sub    %ecx,%edx
  801da0:	0f b6 4d e7          	movzbl -0x19(%ebp),%ecx
  801da4:	88 4c 13 08          	mov    %cl,0x8(%ebx,%edx,1)
		p->p_wpos++;
  801da8:	83 c0 01             	add    $0x1,%eax
  801dab:	89 43 04             	mov    %eax,0x4(%ebx)
	for (i = 0; i < n; i++) {
  801dae:	83 c7 01             	add    $0x1,%edi
  801db1:	eb ac                	jmp    801d5f <devpipe_write+0x20>
	return i;
  801db3:	8b 45 10             	mov    0x10(%ebp),%eax
  801db6:	eb 05                	jmp    801dbd <devpipe_write+0x7e>
				return 0;
  801db8:	b8 00 00 00 00       	mov    $0x0,%eax
}
  801dbd:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801dc0:	5b                   	pop    %ebx
  801dc1:	5e                   	pop    %esi
  801dc2:	5f                   	pop    %edi
  801dc3:	5d                   	pop    %ebp
  801dc4:	c3                   	ret    

00801dc5 <devpipe_read>:
{
  801dc5:	f3 0f 1e fb          	endbr32 
  801dc9:	55                   	push   %ebp
  801dca:	89 e5                	mov    %esp,%ebp
  801dcc:	57                   	push   %edi
  801dcd:	56                   	push   %esi
  801dce:	53                   	push   %ebx
  801dcf:	83 ec 18             	sub    $0x18,%esp
  801dd2:	8b 7d 08             	mov    0x8(%ebp),%edi
	p = (struct Pipe*)fd2data(fd);
  801dd5:	57                   	push   %edi
  801dd6:	e8 3d f0 ff ff       	call   800e18 <fd2data>
  801ddb:	89 c3                	mov    %eax,%ebx
	for (i = 0; i < n; i++) {
  801ddd:	83 c4 10             	add    $0x10,%esp
  801de0:	be 00 00 00 00       	mov    $0x0,%esi
  801de5:	3b 75 10             	cmp    0x10(%ebp),%esi
  801de8:	75 14                	jne    801dfe <devpipe_read+0x39>
	return i;
  801dea:	8b 45 10             	mov    0x10(%ebp),%eax
  801ded:	eb 02                	jmp    801df1 <devpipe_read+0x2c>
				return i;
  801def:	89 f0                	mov    %esi,%eax
}
  801df1:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801df4:	5b                   	pop    %ebx
  801df5:	5e                   	pop    %esi
  801df6:	5f                   	pop    %edi
  801df7:	5d                   	pop    %ebp
  801df8:	c3                   	ret    
			sys_yield();
  801df9:	e8 d2 ed ff ff       	call   800bd0 <sys_yield>
		while (p->p_rpos == p->p_wpos) {
  801dfe:	8b 03                	mov    (%ebx),%eax
  801e00:	3b 43 04             	cmp    0x4(%ebx),%eax
  801e03:	75 18                	jne    801e1d <devpipe_read+0x58>
			if (i > 0)
  801e05:	85 f6                	test   %esi,%esi
  801e07:	75 e6                	jne    801def <devpipe_read+0x2a>
			if (_pipeisclosed(fd, p))
  801e09:	89 da                	mov    %ebx,%edx
  801e0b:	89 f8                	mov    %edi,%eax
  801e0d:	e8 c8 fe ff ff       	call   801cda <_pipeisclosed>
  801e12:	85 c0                	test   %eax,%eax
  801e14:	74 e3                	je     801df9 <devpipe_read+0x34>
				return 0;
  801e16:	b8 00 00 00 00       	mov    $0x0,%eax
  801e1b:	eb d4                	jmp    801df1 <devpipe_read+0x2c>
		buf[i] = p->p_buf[p->p_rpos % PIPEBUFSIZ];
  801e1d:	99                   	cltd   
  801e1e:	c1 ea 1b             	shr    $0x1b,%edx
  801e21:	01 d0                	add    %edx,%eax
  801e23:	83 e0 1f             	and    $0x1f,%eax
  801e26:	29 d0                	sub    %edx,%eax
  801e28:	0f b6 44 03 08       	movzbl 0x8(%ebx,%eax,1),%eax
  801e2d:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  801e30:	88 04 31             	mov    %al,(%ecx,%esi,1)
		p->p_rpos++;
  801e33:	83 03 01             	addl   $0x1,(%ebx)
	for (i = 0; i < n; i++) {
  801e36:	83 c6 01             	add    $0x1,%esi
  801e39:	eb aa                	jmp    801de5 <devpipe_read+0x20>

00801e3b <pipe>:
{
  801e3b:	f3 0f 1e fb          	endbr32 
  801e3f:	55                   	push   %ebp
  801e40:	89 e5                	mov    %esp,%ebp
  801e42:	56                   	push   %esi
  801e43:	53                   	push   %ebx
  801e44:	83 ec 1c             	sub    $0x1c,%esp
	if ((r = fd_alloc(&fd0)) < 0
  801e47:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801e4a:	50                   	push   %eax
  801e4b:	e8 e3 ef ff ff       	call   800e33 <fd_alloc>
  801e50:	89 c3                	mov    %eax,%ebx
  801e52:	83 c4 10             	add    $0x10,%esp
  801e55:	85 c0                	test   %eax,%eax
  801e57:	0f 88 23 01 00 00    	js     801f80 <pipe+0x145>
	    || (r = sys_page_alloc(0, fd0, PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
  801e5d:	83 ec 04             	sub    $0x4,%esp
  801e60:	68 07 04 00 00       	push   $0x407
  801e65:	ff 75 f4             	pushl  -0xc(%ebp)
  801e68:	6a 00                	push   $0x0
  801e6a:	e8 84 ed ff ff       	call   800bf3 <sys_page_alloc>
  801e6f:	89 c3                	mov    %eax,%ebx
  801e71:	83 c4 10             	add    $0x10,%esp
  801e74:	85 c0                	test   %eax,%eax
  801e76:	0f 88 04 01 00 00    	js     801f80 <pipe+0x145>
	if ((r = fd_alloc(&fd1)) < 0
  801e7c:	83 ec 0c             	sub    $0xc,%esp
  801e7f:	8d 45 f0             	lea    -0x10(%ebp),%eax
  801e82:	50                   	push   %eax
  801e83:	e8 ab ef ff ff       	call   800e33 <fd_alloc>
  801e88:	89 c3                	mov    %eax,%ebx
  801e8a:	83 c4 10             	add    $0x10,%esp
  801e8d:	85 c0                	test   %eax,%eax
  801e8f:	0f 88 db 00 00 00    	js     801f70 <pipe+0x135>
	    || (r = sys_page_alloc(0, fd1, PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
  801e95:	83 ec 04             	sub    $0x4,%esp
  801e98:	68 07 04 00 00       	push   $0x407
  801e9d:	ff 75 f0             	pushl  -0x10(%ebp)
  801ea0:	6a 00                	push   $0x0
  801ea2:	e8 4c ed ff ff       	call   800bf3 <sys_page_alloc>
  801ea7:	89 c3                	mov    %eax,%ebx
  801ea9:	83 c4 10             	add    $0x10,%esp
  801eac:	85 c0                	test   %eax,%eax
  801eae:	0f 88 bc 00 00 00    	js     801f70 <pipe+0x135>
	va = fd2data(fd0);
  801eb4:	83 ec 0c             	sub    $0xc,%esp
  801eb7:	ff 75 f4             	pushl  -0xc(%ebp)
  801eba:	e8 59 ef ff ff       	call   800e18 <fd2data>
  801ebf:	89 c6                	mov    %eax,%esi
	if ((r = sys_page_alloc(0, va, PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
  801ec1:	83 c4 0c             	add    $0xc,%esp
  801ec4:	68 07 04 00 00       	push   $0x407
  801ec9:	50                   	push   %eax
  801eca:	6a 00                	push   $0x0
  801ecc:	e8 22 ed ff ff       	call   800bf3 <sys_page_alloc>
  801ed1:	89 c3                	mov    %eax,%ebx
  801ed3:	83 c4 10             	add    $0x10,%esp
  801ed6:	85 c0                	test   %eax,%eax
  801ed8:	0f 88 82 00 00 00    	js     801f60 <pipe+0x125>
	if ((r = sys_page_map(0, va, 0, fd2data(fd1), PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
  801ede:	83 ec 0c             	sub    $0xc,%esp
  801ee1:	ff 75 f0             	pushl  -0x10(%ebp)
  801ee4:	e8 2f ef ff ff       	call   800e18 <fd2data>
  801ee9:	c7 04 24 07 04 00 00 	movl   $0x407,(%esp)
  801ef0:	50                   	push   %eax
  801ef1:	6a 00                	push   $0x0
  801ef3:	56                   	push   %esi
  801ef4:	6a 00                	push   $0x0
  801ef6:	e8 3f ed ff ff       	call   800c3a <sys_page_map>
  801efb:	89 c3                	mov    %eax,%ebx
  801efd:	83 c4 20             	add    $0x20,%esp
  801f00:	85 c0                	test   %eax,%eax
  801f02:	78 4e                	js     801f52 <pipe+0x117>
	fd0->fd_dev_id = devpipe.dev_id;
  801f04:	a1 20 30 80 00       	mov    0x803020,%eax
  801f09:	8b 55 f4             	mov    -0xc(%ebp),%edx
  801f0c:	89 02                	mov    %eax,(%edx)
	fd0->fd_omode = O_RDONLY;
  801f0e:	8b 55 f4             	mov    -0xc(%ebp),%edx
  801f11:	c7 42 08 00 00 00 00 	movl   $0x0,0x8(%edx)
	fd1->fd_dev_id = devpipe.dev_id;
  801f18:	8b 55 f0             	mov    -0x10(%ebp),%edx
  801f1b:	89 02                	mov    %eax,(%edx)
	fd1->fd_omode = O_WRONLY;
  801f1d:	8b 45 f0             	mov    -0x10(%ebp),%eax
  801f20:	c7 40 08 01 00 00 00 	movl   $0x1,0x8(%eax)
	pfd[0] = fd2num(fd0);
  801f27:	83 ec 0c             	sub    $0xc,%esp
  801f2a:	ff 75 f4             	pushl  -0xc(%ebp)
  801f2d:	e8 d2 ee ff ff       	call   800e04 <fd2num>
  801f32:	8b 4d 08             	mov    0x8(%ebp),%ecx
  801f35:	89 01                	mov    %eax,(%ecx)
	pfd[1] = fd2num(fd1);
  801f37:	83 c4 04             	add    $0x4,%esp
  801f3a:	ff 75 f0             	pushl  -0x10(%ebp)
  801f3d:	e8 c2 ee ff ff       	call   800e04 <fd2num>
  801f42:	8b 4d 08             	mov    0x8(%ebp),%ecx
  801f45:	89 41 04             	mov    %eax,0x4(%ecx)
	return 0;
  801f48:	83 c4 10             	add    $0x10,%esp
  801f4b:	bb 00 00 00 00       	mov    $0x0,%ebx
  801f50:	eb 2e                	jmp    801f80 <pipe+0x145>
	sys_page_unmap(0, va);
  801f52:	83 ec 08             	sub    $0x8,%esp
  801f55:	56                   	push   %esi
  801f56:	6a 00                	push   $0x0
  801f58:	e8 23 ed ff ff       	call   800c80 <sys_page_unmap>
  801f5d:	83 c4 10             	add    $0x10,%esp
	sys_page_unmap(0, fd1);
  801f60:	83 ec 08             	sub    $0x8,%esp
  801f63:	ff 75 f0             	pushl  -0x10(%ebp)
  801f66:	6a 00                	push   $0x0
  801f68:	e8 13 ed ff ff       	call   800c80 <sys_page_unmap>
  801f6d:	83 c4 10             	add    $0x10,%esp
	sys_page_unmap(0, fd0);
  801f70:	83 ec 08             	sub    $0x8,%esp
  801f73:	ff 75 f4             	pushl  -0xc(%ebp)
  801f76:	6a 00                	push   $0x0
  801f78:	e8 03 ed ff ff       	call   800c80 <sys_page_unmap>
  801f7d:	83 c4 10             	add    $0x10,%esp
}
  801f80:	89 d8                	mov    %ebx,%eax
  801f82:	8d 65 f8             	lea    -0x8(%ebp),%esp
  801f85:	5b                   	pop    %ebx
  801f86:	5e                   	pop    %esi
  801f87:	5d                   	pop    %ebp
  801f88:	c3                   	ret    

00801f89 <pipeisclosed>:
{
  801f89:	f3 0f 1e fb          	endbr32 
  801f8d:	55                   	push   %ebp
  801f8e:	89 e5                	mov    %esp,%ebp
  801f90:	83 ec 20             	sub    $0x20,%esp
	if ((r = fd_lookup(fdnum, &fd)) < 0)
  801f93:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801f96:	50                   	push   %eax
  801f97:	ff 75 08             	pushl  0x8(%ebp)
  801f9a:	e8 ea ee ff ff       	call   800e89 <fd_lookup>
  801f9f:	83 c4 10             	add    $0x10,%esp
  801fa2:	85 c0                	test   %eax,%eax
  801fa4:	78 18                	js     801fbe <pipeisclosed+0x35>
	p = (struct Pipe*) fd2data(fd);
  801fa6:	83 ec 0c             	sub    $0xc,%esp
  801fa9:	ff 75 f4             	pushl  -0xc(%ebp)
  801fac:	e8 67 ee ff ff       	call   800e18 <fd2data>
  801fb1:	89 c2                	mov    %eax,%edx
	return _pipeisclosed(fd, p);
  801fb3:	8b 45 f4             	mov    -0xc(%ebp),%eax
  801fb6:	e8 1f fd ff ff       	call   801cda <_pipeisclosed>
  801fbb:	83 c4 10             	add    $0x10,%esp
}
  801fbe:	c9                   	leave  
  801fbf:	c3                   	ret    

00801fc0 <devcons_close>:
	return tot;
}

static int
devcons_close(struct Fd *fd)
{
  801fc0:	f3 0f 1e fb          	endbr32 
	USED(fd);

	return 0;
}
  801fc4:	b8 00 00 00 00       	mov    $0x0,%eax
  801fc9:	c3                   	ret    

00801fca <devcons_stat>:

static int
devcons_stat(struct Fd *fd, struct Stat *stat)
{
  801fca:	f3 0f 1e fb          	endbr32 
  801fce:	55                   	push   %ebp
  801fcf:	89 e5                	mov    %esp,%ebp
  801fd1:	83 ec 10             	sub    $0x10,%esp
	strcpy(stat->st_name, "<cons>");
  801fd4:	68 45 2a 80 00       	push   $0x802a45
  801fd9:	ff 75 0c             	pushl  0xc(%ebp)
  801fdc:	e8 d0 e7 ff ff       	call   8007b1 <strcpy>
	return 0;
}
  801fe1:	b8 00 00 00 00       	mov    $0x0,%eax
  801fe6:	c9                   	leave  
  801fe7:	c3                   	ret    

00801fe8 <devcons_write>:
{
  801fe8:	f3 0f 1e fb          	endbr32 
  801fec:	55                   	push   %ebp
  801fed:	89 e5                	mov    %esp,%ebp
  801fef:	57                   	push   %edi
  801ff0:	56                   	push   %esi
  801ff1:	53                   	push   %ebx
  801ff2:	81 ec 8c 00 00 00    	sub    $0x8c,%esp
	for (tot = 0; tot < n; tot += m) {
  801ff8:	be 00 00 00 00       	mov    $0x0,%esi
		memmove(buf, (char*)vbuf + tot, m);
  801ffd:	8d bd 68 ff ff ff    	lea    -0x98(%ebp),%edi
	for (tot = 0; tot < n; tot += m) {
  802003:	3b 75 10             	cmp    0x10(%ebp),%esi
  802006:	73 31                	jae    802039 <devcons_write+0x51>
		m = n - tot;
  802008:	8b 5d 10             	mov    0x10(%ebp),%ebx
  80200b:	29 f3                	sub    %esi,%ebx
  80200d:	83 fb 7f             	cmp    $0x7f,%ebx
  802010:	b8 7f 00 00 00       	mov    $0x7f,%eax
  802015:	0f 47 d8             	cmova  %eax,%ebx
		memmove(buf, (char*)vbuf + tot, m);
  802018:	83 ec 04             	sub    $0x4,%esp
  80201b:	53                   	push   %ebx
  80201c:	89 f0                	mov    %esi,%eax
  80201e:	03 45 0c             	add    0xc(%ebp),%eax
  802021:	50                   	push   %eax
  802022:	57                   	push   %edi
  802023:	e8 3f e9 ff ff       	call   800967 <memmove>
		sys_cputs(buf, m);
  802028:	83 c4 08             	add    $0x8,%esp
  80202b:	53                   	push   %ebx
  80202c:	57                   	push   %edi
  80202d:	e8 f1 ea ff ff       	call   800b23 <sys_cputs>
	for (tot = 0; tot < n; tot += m) {
  802032:	01 de                	add    %ebx,%esi
  802034:	83 c4 10             	add    $0x10,%esp
  802037:	eb ca                	jmp    802003 <devcons_write+0x1b>
}
  802039:	89 f0                	mov    %esi,%eax
  80203b:	8d 65 f4             	lea    -0xc(%ebp),%esp
  80203e:	5b                   	pop    %ebx
  80203f:	5e                   	pop    %esi
  802040:	5f                   	pop    %edi
  802041:	5d                   	pop    %ebp
  802042:	c3                   	ret    

00802043 <devcons_read>:
{
  802043:	f3 0f 1e fb          	endbr32 
  802047:	55                   	push   %ebp
  802048:	89 e5                	mov    %esp,%ebp
  80204a:	83 ec 08             	sub    $0x8,%esp
  80204d:	b8 00 00 00 00       	mov    $0x0,%eax
	if (n == 0)
  802052:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
  802056:	74 21                	je     802079 <devcons_read+0x36>
	while ((c = sys_cgetc()) == 0)
  802058:	e8 e8 ea ff ff       	call   800b45 <sys_cgetc>
  80205d:	85 c0                	test   %eax,%eax
  80205f:	75 07                	jne    802068 <devcons_read+0x25>
		sys_yield();
  802061:	e8 6a eb ff ff       	call   800bd0 <sys_yield>
  802066:	eb f0                	jmp    802058 <devcons_read+0x15>
	if (c < 0)
  802068:	78 0f                	js     802079 <devcons_read+0x36>
	if (c == 0x04)	// ctl-d is eof
  80206a:	83 f8 04             	cmp    $0x4,%eax
  80206d:	74 0c                	je     80207b <devcons_read+0x38>
	*(char*)vbuf = c;
  80206f:	8b 55 0c             	mov    0xc(%ebp),%edx
  802072:	88 02                	mov    %al,(%edx)
	return 1;
  802074:	b8 01 00 00 00       	mov    $0x1,%eax
}
  802079:	c9                   	leave  
  80207a:	c3                   	ret    
		return 0;
  80207b:	b8 00 00 00 00       	mov    $0x0,%eax
  802080:	eb f7                	jmp    802079 <devcons_read+0x36>

00802082 <cputchar>:
{
  802082:	f3 0f 1e fb          	endbr32 
  802086:	55                   	push   %ebp
  802087:	89 e5                	mov    %esp,%ebp
  802089:	83 ec 20             	sub    $0x20,%esp
	char c = ch;
  80208c:	8b 45 08             	mov    0x8(%ebp),%eax
  80208f:	88 45 f7             	mov    %al,-0x9(%ebp)
	sys_cputs(&c, 1);
  802092:	6a 01                	push   $0x1
  802094:	8d 45 f7             	lea    -0x9(%ebp),%eax
  802097:	50                   	push   %eax
  802098:	e8 86 ea ff ff       	call   800b23 <sys_cputs>
}
  80209d:	83 c4 10             	add    $0x10,%esp
  8020a0:	c9                   	leave  
  8020a1:	c3                   	ret    

008020a2 <getchar>:
{
  8020a2:	f3 0f 1e fb          	endbr32 
  8020a6:	55                   	push   %ebp
  8020a7:	89 e5                	mov    %esp,%ebp
  8020a9:	83 ec 1c             	sub    $0x1c,%esp
	r = read(0, &c, 1);
  8020ac:	6a 01                	push   $0x1
  8020ae:	8d 45 f7             	lea    -0x9(%ebp),%eax
  8020b1:	50                   	push   %eax
  8020b2:	6a 00                	push   $0x0
  8020b4:	e8 53 f0 ff ff       	call   80110c <read>
	if (r < 0)
  8020b9:	83 c4 10             	add    $0x10,%esp
  8020bc:	85 c0                	test   %eax,%eax
  8020be:	78 06                	js     8020c6 <getchar+0x24>
	if (r < 1)
  8020c0:	74 06                	je     8020c8 <getchar+0x26>
	return c;
  8020c2:	0f b6 45 f7          	movzbl -0x9(%ebp),%eax
}
  8020c6:	c9                   	leave  
  8020c7:	c3                   	ret    
		return -E_EOF;
  8020c8:	b8 f8 ff ff ff       	mov    $0xfffffff8,%eax
  8020cd:	eb f7                	jmp    8020c6 <getchar+0x24>

008020cf <iscons>:
{
  8020cf:	f3 0f 1e fb          	endbr32 
  8020d3:	55                   	push   %ebp
  8020d4:	89 e5                	mov    %esp,%ebp
  8020d6:	83 ec 20             	sub    $0x20,%esp
	if ((r = fd_lookup(fdnum, &fd)) < 0)
  8020d9:	8d 45 f4             	lea    -0xc(%ebp),%eax
  8020dc:	50                   	push   %eax
  8020dd:	ff 75 08             	pushl  0x8(%ebp)
  8020e0:	e8 a4 ed ff ff       	call   800e89 <fd_lookup>
  8020e5:	83 c4 10             	add    $0x10,%esp
  8020e8:	85 c0                	test   %eax,%eax
  8020ea:	78 11                	js     8020fd <iscons+0x2e>
	return fd->fd_dev_id == devcons.dev_id;
  8020ec:	8b 45 f4             	mov    -0xc(%ebp),%eax
  8020ef:	8b 15 3c 30 80 00    	mov    0x80303c,%edx
  8020f5:	39 10                	cmp    %edx,(%eax)
  8020f7:	0f 94 c0             	sete   %al
  8020fa:	0f b6 c0             	movzbl %al,%eax
}
  8020fd:	c9                   	leave  
  8020fe:	c3                   	ret    

008020ff <opencons>:
{
  8020ff:	f3 0f 1e fb          	endbr32 
  802103:	55                   	push   %ebp
  802104:	89 e5                	mov    %esp,%ebp
  802106:	83 ec 24             	sub    $0x24,%esp
	if ((r = fd_alloc(&fd)) < 0)
  802109:	8d 45 f4             	lea    -0xc(%ebp),%eax
  80210c:	50                   	push   %eax
  80210d:	e8 21 ed ff ff       	call   800e33 <fd_alloc>
  802112:	83 c4 10             	add    $0x10,%esp
  802115:	85 c0                	test   %eax,%eax
  802117:	78 3a                	js     802153 <opencons+0x54>
	if ((r = sys_page_alloc(0, fd, PTE_P|PTE_U|PTE_W|PTE_SHARE)) < 0)
  802119:	83 ec 04             	sub    $0x4,%esp
  80211c:	68 07 04 00 00       	push   $0x407
  802121:	ff 75 f4             	pushl  -0xc(%ebp)
  802124:	6a 00                	push   $0x0
  802126:	e8 c8 ea ff ff       	call   800bf3 <sys_page_alloc>
  80212b:	83 c4 10             	add    $0x10,%esp
  80212e:	85 c0                	test   %eax,%eax
  802130:	78 21                	js     802153 <opencons+0x54>
	fd->fd_dev_id = devcons.dev_id;
  802132:	8b 45 f4             	mov    -0xc(%ebp),%eax
  802135:	8b 15 3c 30 80 00    	mov    0x80303c,%edx
  80213b:	89 10                	mov    %edx,(%eax)
	fd->fd_omode = O_RDWR;
  80213d:	8b 45 f4             	mov    -0xc(%ebp),%eax
  802140:	c7 40 08 02 00 00 00 	movl   $0x2,0x8(%eax)
	return fd2num(fd);
  802147:	83 ec 0c             	sub    $0xc,%esp
  80214a:	50                   	push   %eax
  80214b:	e8 b4 ec ff ff       	call   800e04 <fd2num>
  802150:	83 c4 10             	add    $0x10,%esp
}
  802153:	c9                   	leave  
  802154:	c3                   	ret    

00802155 <ipc_recv>:
//   If 'pg' is null, pass sys_ipc_recv a value that it will understand
//   as meaning "no page".  (Zero is not the right value, since that's
//   a perfectly valid place to map a page.)
int32_t
ipc_recv(envid_t *from_env_store, void *pg, int *perm_store)
{
  802155:	f3 0f 1e fb          	endbr32 
  802159:	55                   	push   %ebp
  80215a:	89 e5                	mov    %esp,%ebp
  80215c:	56                   	push   %esi
  80215d:	53                   	push   %ebx
  80215e:	8b 75 08             	mov    0x8(%ebp),%esi
  802161:	8b 45 0c             	mov    0xc(%ebp),%eax
  802164:	8b 5d 10             	mov    0x10(%ebp),%ebx
	// LAB 4: Your code here.
	int error;
	if(!pg)pg = (void *)UTOP; // 如果设置为UTOP，这个值其实可以比UTOP大，设置为这个值认为pg无效了，不会进行页面传递【共享页面的设置】，而是只进行值value的传递。
  802167:	85 c0                	test   %eax,%eax
  802169:	ba 00 00 c0 ee       	mov    $0xeec00000,%edx
  80216e:	0f 44 c2             	cmove  %edx,%eax
	if((error = sys_ipc_recv(pg)) < 0){
  802171:	83 ec 0c             	sub    $0xc,%esp
  802174:	50                   	push   %eax
  802175:	e8 45 ec ff ff       	call   800dbf <sys_ipc_recv>
  80217a:	83 c4 10             	add    $0x10,%esp
  80217d:	85 c0                	test   %eax,%eax
  80217f:	78 3f                	js     8021c0 <ipc_recv+0x6b>
		if(from_env_store)*from_env_store = 0;
		if(perm_store)*perm_store = 0;
		return error;
	}

	thisenv = &envs[ENVX(sys_getenvid())]; // for lab4's challenge sfork().
  802181:	e8 27 ea ff ff       	call   800bad <sys_getenvid>
  802186:	25 ff 03 00 00       	and    $0x3ff,%eax
  80218b:	6b d0 7c             	imul   $0x7c,%eax,%edx
  80218e:	81 c2 00 00 c0 ee    	add    $0xeec00000,%edx
  802194:	89 15 04 40 80 00    	mov    %edx,0x804004

	if(from_env_store)*from_env_store = thisenv->env_ipc_from;
  80219a:	85 f6                	test   %esi,%esi
  80219c:	74 05                	je     8021a3 <ipc_recv+0x4e>
  80219e:	8b 42 74             	mov    0x74(%edx),%eax
  8021a1:	89 06                	mov    %eax,(%esi)
	if(perm_store)*perm_store = thisenv->env_ipc_perm;
  8021a3:	85 db                	test   %ebx,%ebx
  8021a5:	74 0a                	je     8021b1 <ipc_recv+0x5c>
  8021a7:	a1 04 40 80 00       	mov    0x804004,%eax
  8021ac:	8b 40 78             	mov    0x78(%eax),%eax
  8021af:	89 03                	mov    %eax,(%ebx)
	return thisenv->env_ipc_value;
  8021b1:	a1 04 40 80 00       	mov    0x804004,%eax
  8021b6:	8b 40 70             	mov    0x70(%eax),%eax
}
  8021b9:	8d 65 f8             	lea    -0x8(%ebp),%esp
  8021bc:	5b                   	pop    %ebx
  8021bd:	5e                   	pop    %esi
  8021be:	5d                   	pop    %ebp
  8021bf:	c3                   	ret    
		if(from_env_store)*from_env_store = 0;
  8021c0:	85 f6                	test   %esi,%esi
  8021c2:	74 06                	je     8021ca <ipc_recv+0x75>
  8021c4:	c7 06 00 00 00 00    	movl   $0x0,(%esi)
		if(perm_store)*perm_store = 0;
  8021ca:	85 db                	test   %ebx,%ebx
  8021cc:	74 eb                	je     8021b9 <ipc_recv+0x64>
  8021ce:	c7 03 00 00 00 00    	movl   $0x0,(%ebx)
  8021d4:	eb e3                	jmp    8021b9 <ipc_recv+0x64>

008021d6 <ipc_send>:
//   Use sys_yield() to be CPU-friendly.
//   If 'pg' is null, pass sys_ipc_try_send a value that it will understand
//   as meaning "no page".  (Zero is not the right value.)
void
ipc_send(envid_t to_env, uint32_t val, void *pg, int perm)
{
  8021d6:	f3 0f 1e fb          	endbr32 
  8021da:	55                   	push   %ebp
  8021db:	89 e5                	mov    %esp,%ebp
  8021dd:	57                   	push   %edi
  8021de:	56                   	push   %esi
  8021df:	53                   	push   %ebx
  8021e0:	83 ec 0c             	sub    $0xc,%esp
  8021e3:	8b 7d 08             	mov    0x8(%ebp),%edi
  8021e6:	8b 75 0c             	mov    0xc(%ebp),%esi
  8021e9:	8b 5d 10             	mov    0x10(%ebp),%ebx
	// LAB 4: Your code here.
	if(!pg)pg = (void *)UTOP; // 不会进行页面共享，只会sending message。
  8021ec:	85 db                	test   %ebx,%ebx
  8021ee:	b8 00 00 c0 ee       	mov    $0xeec00000,%eax
  8021f3:	0f 44 d8             	cmove  %eax,%ebx
	int error;
	// Keep trying until it succeeds.
	while((error = sys_ipc_try_send(to_env, val, pg, perm)) < 0){
  8021f6:	ff 75 14             	pushl  0x14(%ebp)
  8021f9:	53                   	push   %ebx
  8021fa:	56                   	push   %esi
  8021fb:	57                   	push   %edi
  8021fc:	e8 97 eb ff ff       	call   800d98 <sys_ipc_try_send>
  802201:	83 c4 10             	add    $0x10,%esp
  802204:	85 c0                	test   %eax,%eax
  802206:	79 1e                	jns    802226 <ipc_send+0x50>
        //如果error是没有接收者，那么就会继续尝试send
		if(error != -E_IPC_NOT_RECV){
  802208:	83 f8 f9             	cmp    $0xfffffff9,%eax
  80220b:	75 07                	jne    802214 <ipc_send+0x3e>
			panic("sys_ipc_try_send:%e", error);
		}
        //但是不是一味的占用cpu，而是尝试一次就释放CPU，等待再次被调度，才会重新send，寻找receiver。
		sys_yield(); // To be CPU-friendly.
  80220d:	e8 be e9 ff ff       	call   800bd0 <sys_yield>
  802212:	eb e2                	jmp    8021f6 <ipc_send+0x20>
			panic("sys_ipc_try_send:%e", error);
  802214:	50                   	push   %eax
  802215:	68 51 2a 80 00       	push   $0x802a51
  80221a:	6a 3b                	push   $0x3b
  80221c:	68 65 2a 80 00       	push   $0x802a65
  802221:	e8 cb de ff ff       	call   8000f1 <_panic>
	}
}
  802226:	8d 65 f4             	lea    -0xc(%ebp),%esp
  802229:	5b                   	pop    %ebx
  80222a:	5e                   	pop    %esi
  80222b:	5f                   	pop    %edi
  80222c:	5d                   	pop    %ebp
  80222d:	c3                   	ret    

0080222e <ipc_find_env>:
// Find the first environment of the given type.  We'll use this to
// find special environments.
// Returns 0 if no such environment exists.
envid_t
ipc_find_env(enum EnvType type)
{
  80222e:	f3 0f 1e fb          	endbr32 
  802232:	55                   	push   %ebp
  802233:	89 e5                	mov    %esp,%ebp
  802235:	8b 4d 08             	mov    0x8(%ebp),%ecx
	int i;
	for (i = 0; i < NENV; i++)
  802238:	b8 00 00 00 00       	mov    $0x0,%eax
		if (envs[i].env_type == type)
  80223d:	6b d0 7c             	imul   $0x7c,%eax,%edx
  802240:	81 c2 00 00 c0 ee    	add    $0xeec00000,%edx
  802246:	8b 52 50             	mov    0x50(%edx),%edx
  802249:	39 ca                	cmp    %ecx,%edx
  80224b:	74 11                	je     80225e <ipc_find_env+0x30>
	for (i = 0; i < NENV; i++)
  80224d:	83 c0 01             	add    $0x1,%eax
  802250:	3d 00 04 00 00       	cmp    $0x400,%eax
  802255:	75 e6                	jne    80223d <ipc_find_env+0xf>
			return envs[i].env_id;
	return 0;
  802257:	b8 00 00 00 00       	mov    $0x0,%eax
  80225c:	eb 0b                	jmp    802269 <ipc_find_env+0x3b>
			return envs[i].env_id;
  80225e:	6b c0 7c             	imul   $0x7c,%eax,%eax
  802261:	05 00 00 c0 ee       	add    $0xeec00000,%eax
  802266:	8b 40 48             	mov    0x48(%eax),%eax
}
  802269:	5d                   	pop    %ebp
  80226a:	c3                   	ret    

0080226b <pageref>:
#include <inc/lib.h>

int
pageref(void *v)
{
  80226b:	f3 0f 1e fb          	endbr32 
  80226f:	55                   	push   %ebp
  802270:	89 e5                	mov    %esp,%ebp
  802272:	8b 45 08             	mov    0x8(%ebp),%eax
	pte_t pte;

	if (!(uvpd[PDX(v)] & PTE_P))
  802275:	89 c2                	mov    %eax,%edx
  802277:	c1 ea 16             	shr    $0x16,%edx
  80227a:	8b 0c 95 00 d0 7b ef 	mov    -0x10843000(,%edx,4),%ecx
		return 0;
  802281:	ba 00 00 00 00       	mov    $0x0,%edx
	if (!(uvpd[PDX(v)] & PTE_P))
  802286:	f6 c1 01             	test   $0x1,%cl
  802289:	74 1c                	je     8022a7 <pageref+0x3c>
	pte = uvpt[PGNUM(v)];
  80228b:	c1 e8 0c             	shr    $0xc,%eax
  80228e:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
	if (!(pte & PTE_P))
  802295:	a8 01                	test   $0x1,%al
  802297:	74 0e                	je     8022a7 <pageref+0x3c>
		return 0;
	return pages[PGNUM(pte)].pp_ref;
  802299:	c1 e8 0c             	shr    $0xc,%eax
  80229c:	0f b7 14 c5 04 00 00 	movzwl -0x10fffffc(,%eax,8),%edx
  8022a3:	ef 
  8022a4:	0f b7 d2             	movzwl %dx,%edx
}
  8022a7:	89 d0                	mov    %edx,%eax
  8022a9:	5d                   	pop    %ebp
  8022aa:	c3                   	ret    
  8022ab:	66 90                	xchg   %ax,%ax
  8022ad:	66 90                	xchg   %ax,%ax
  8022af:	90                   	nop

008022b0 <__udivdi3>:
  8022b0:	f3 0f 1e fb          	endbr32 
  8022b4:	55                   	push   %ebp
  8022b5:	57                   	push   %edi
  8022b6:	56                   	push   %esi
  8022b7:	53                   	push   %ebx
  8022b8:	83 ec 1c             	sub    $0x1c,%esp
  8022bb:	8b 54 24 3c          	mov    0x3c(%esp),%edx
  8022bf:	8b 6c 24 30          	mov    0x30(%esp),%ebp
  8022c3:	8b 74 24 34          	mov    0x34(%esp),%esi
  8022c7:	8b 5c 24 38          	mov    0x38(%esp),%ebx
  8022cb:	85 d2                	test   %edx,%edx
  8022cd:	75 19                	jne    8022e8 <__udivdi3+0x38>
  8022cf:	39 f3                	cmp    %esi,%ebx
  8022d1:	76 4d                	jbe    802320 <__udivdi3+0x70>
  8022d3:	31 ff                	xor    %edi,%edi
  8022d5:	89 e8                	mov    %ebp,%eax
  8022d7:	89 f2                	mov    %esi,%edx
  8022d9:	f7 f3                	div    %ebx
  8022db:	89 fa                	mov    %edi,%edx
  8022dd:	83 c4 1c             	add    $0x1c,%esp
  8022e0:	5b                   	pop    %ebx
  8022e1:	5e                   	pop    %esi
  8022e2:	5f                   	pop    %edi
  8022e3:	5d                   	pop    %ebp
  8022e4:	c3                   	ret    
  8022e5:	8d 76 00             	lea    0x0(%esi),%esi
  8022e8:	39 f2                	cmp    %esi,%edx
  8022ea:	76 14                	jbe    802300 <__udivdi3+0x50>
  8022ec:	31 ff                	xor    %edi,%edi
  8022ee:	31 c0                	xor    %eax,%eax
  8022f0:	89 fa                	mov    %edi,%edx
  8022f2:	83 c4 1c             	add    $0x1c,%esp
  8022f5:	5b                   	pop    %ebx
  8022f6:	5e                   	pop    %esi
  8022f7:	5f                   	pop    %edi
  8022f8:	5d                   	pop    %ebp
  8022f9:	c3                   	ret    
  8022fa:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
  802300:	0f bd fa             	bsr    %edx,%edi
  802303:	83 f7 1f             	xor    $0x1f,%edi
  802306:	75 48                	jne    802350 <__udivdi3+0xa0>
  802308:	39 f2                	cmp    %esi,%edx
  80230a:	72 06                	jb     802312 <__udivdi3+0x62>
  80230c:	31 c0                	xor    %eax,%eax
  80230e:	39 eb                	cmp    %ebp,%ebx
  802310:	77 de                	ja     8022f0 <__udivdi3+0x40>
  802312:	b8 01 00 00 00       	mov    $0x1,%eax
  802317:	eb d7                	jmp    8022f0 <__udivdi3+0x40>
  802319:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  802320:	89 d9                	mov    %ebx,%ecx
  802322:	85 db                	test   %ebx,%ebx
  802324:	75 0b                	jne    802331 <__udivdi3+0x81>
  802326:	b8 01 00 00 00       	mov    $0x1,%eax
  80232b:	31 d2                	xor    %edx,%edx
  80232d:	f7 f3                	div    %ebx
  80232f:	89 c1                	mov    %eax,%ecx
  802331:	31 d2                	xor    %edx,%edx
  802333:	89 f0                	mov    %esi,%eax
  802335:	f7 f1                	div    %ecx
  802337:	89 c6                	mov    %eax,%esi
  802339:	89 e8                	mov    %ebp,%eax
  80233b:	89 f7                	mov    %esi,%edi
  80233d:	f7 f1                	div    %ecx
  80233f:	89 fa                	mov    %edi,%edx
  802341:	83 c4 1c             	add    $0x1c,%esp
  802344:	5b                   	pop    %ebx
  802345:	5e                   	pop    %esi
  802346:	5f                   	pop    %edi
  802347:	5d                   	pop    %ebp
  802348:	c3                   	ret    
  802349:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  802350:	89 f9                	mov    %edi,%ecx
  802352:	b8 20 00 00 00       	mov    $0x20,%eax
  802357:	29 f8                	sub    %edi,%eax
  802359:	d3 e2                	shl    %cl,%edx
  80235b:	89 54 24 08          	mov    %edx,0x8(%esp)
  80235f:	89 c1                	mov    %eax,%ecx
  802361:	89 da                	mov    %ebx,%edx
  802363:	d3 ea                	shr    %cl,%edx
  802365:	8b 4c 24 08          	mov    0x8(%esp),%ecx
  802369:	09 d1                	or     %edx,%ecx
  80236b:	89 f2                	mov    %esi,%edx
  80236d:	89 4c 24 08          	mov    %ecx,0x8(%esp)
  802371:	89 f9                	mov    %edi,%ecx
  802373:	d3 e3                	shl    %cl,%ebx
  802375:	89 c1                	mov    %eax,%ecx
  802377:	d3 ea                	shr    %cl,%edx
  802379:	89 f9                	mov    %edi,%ecx
  80237b:	89 5c 24 0c          	mov    %ebx,0xc(%esp)
  80237f:	89 eb                	mov    %ebp,%ebx
  802381:	d3 e6                	shl    %cl,%esi
  802383:	89 c1                	mov    %eax,%ecx
  802385:	d3 eb                	shr    %cl,%ebx
  802387:	09 de                	or     %ebx,%esi
  802389:	89 f0                	mov    %esi,%eax
  80238b:	f7 74 24 08          	divl   0x8(%esp)
  80238f:	89 d6                	mov    %edx,%esi
  802391:	89 c3                	mov    %eax,%ebx
  802393:	f7 64 24 0c          	mull   0xc(%esp)
  802397:	39 d6                	cmp    %edx,%esi
  802399:	72 15                	jb     8023b0 <__udivdi3+0x100>
  80239b:	89 f9                	mov    %edi,%ecx
  80239d:	d3 e5                	shl    %cl,%ebp
  80239f:	39 c5                	cmp    %eax,%ebp
  8023a1:	73 04                	jae    8023a7 <__udivdi3+0xf7>
  8023a3:	39 d6                	cmp    %edx,%esi
  8023a5:	74 09                	je     8023b0 <__udivdi3+0x100>
  8023a7:	89 d8                	mov    %ebx,%eax
  8023a9:	31 ff                	xor    %edi,%edi
  8023ab:	e9 40 ff ff ff       	jmp    8022f0 <__udivdi3+0x40>
  8023b0:	8d 43 ff             	lea    -0x1(%ebx),%eax
  8023b3:	31 ff                	xor    %edi,%edi
  8023b5:	e9 36 ff ff ff       	jmp    8022f0 <__udivdi3+0x40>
  8023ba:	66 90                	xchg   %ax,%ax
  8023bc:	66 90                	xchg   %ax,%ax
  8023be:	66 90                	xchg   %ax,%ax

008023c0 <__umoddi3>:
  8023c0:	f3 0f 1e fb          	endbr32 
  8023c4:	55                   	push   %ebp
  8023c5:	57                   	push   %edi
  8023c6:	56                   	push   %esi
  8023c7:	53                   	push   %ebx
  8023c8:	83 ec 1c             	sub    $0x1c,%esp
  8023cb:	8b 44 24 3c          	mov    0x3c(%esp),%eax
  8023cf:	8b 74 24 30          	mov    0x30(%esp),%esi
  8023d3:	8b 5c 24 34          	mov    0x34(%esp),%ebx
  8023d7:	8b 7c 24 38          	mov    0x38(%esp),%edi
  8023db:	85 c0                	test   %eax,%eax
  8023dd:	75 19                	jne    8023f8 <__umoddi3+0x38>
  8023df:	39 df                	cmp    %ebx,%edi
  8023e1:	76 5d                	jbe    802440 <__umoddi3+0x80>
  8023e3:	89 f0                	mov    %esi,%eax
  8023e5:	89 da                	mov    %ebx,%edx
  8023e7:	f7 f7                	div    %edi
  8023e9:	89 d0                	mov    %edx,%eax
  8023eb:	31 d2                	xor    %edx,%edx
  8023ed:	83 c4 1c             	add    $0x1c,%esp
  8023f0:	5b                   	pop    %ebx
  8023f1:	5e                   	pop    %esi
  8023f2:	5f                   	pop    %edi
  8023f3:	5d                   	pop    %ebp
  8023f4:	c3                   	ret    
  8023f5:	8d 76 00             	lea    0x0(%esi),%esi
  8023f8:	89 f2                	mov    %esi,%edx
  8023fa:	39 d8                	cmp    %ebx,%eax
  8023fc:	76 12                	jbe    802410 <__umoddi3+0x50>
  8023fe:	89 f0                	mov    %esi,%eax
  802400:	89 da                	mov    %ebx,%edx
  802402:	83 c4 1c             	add    $0x1c,%esp
  802405:	5b                   	pop    %ebx
  802406:	5e                   	pop    %esi
  802407:	5f                   	pop    %edi
  802408:	5d                   	pop    %ebp
  802409:	c3                   	ret    
  80240a:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
  802410:	0f bd e8             	bsr    %eax,%ebp
  802413:	83 f5 1f             	xor    $0x1f,%ebp
  802416:	75 50                	jne    802468 <__umoddi3+0xa8>
  802418:	39 d8                	cmp    %ebx,%eax
  80241a:	0f 82 e0 00 00 00    	jb     802500 <__umoddi3+0x140>
  802420:	89 d9                	mov    %ebx,%ecx
  802422:	39 f7                	cmp    %esi,%edi
  802424:	0f 86 d6 00 00 00    	jbe    802500 <__umoddi3+0x140>
  80242a:	89 d0                	mov    %edx,%eax
  80242c:	89 ca                	mov    %ecx,%edx
  80242e:	83 c4 1c             	add    $0x1c,%esp
  802431:	5b                   	pop    %ebx
  802432:	5e                   	pop    %esi
  802433:	5f                   	pop    %edi
  802434:	5d                   	pop    %ebp
  802435:	c3                   	ret    
  802436:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  80243d:	8d 76 00             	lea    0x0(%esi),%esi
  802440:	89 fd                	mov    %edi,%ebp
  802442:	85 ff                	test   %edi,%edi
  802444:	75 0b                	jne    802451 <__umoddi3+0x91>
  802446:	b8 01 00 00 00       	mov    $0x1,%eax
  80244b:	31 d2                	xor    %edx,%edx
  80244d:	f7 f7                	div    %edi
  80244f:	89 c5                	mov    %eax,%ebp
  802451:	89 d8                	mov    %ebx,%eax
  802453:	31 d2                	xor    %edx,%edx
  802455:	f7 f5                	div    %ebp
  802457:	89 f0                	mov    %esi,%eax
  802459:	f7 f5                	div    %ebp
  80245b:	89 d0                	mov    %edx,%eax
  80245d:	31 d2                	xor    %edx,%edx
  80245f:	eb 8c                	jmp    8023ed <__umoddi3+0x2d>
  802461:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  802468:	89 e9                	mov    %ebp,%ecx
  80246a:	ba 20 00 00 00       	mov    $0x20,%edx
  80246f:	29 ea                	sub    %ebp,%edx
  802471:	d3 e0                	shl    %cl,%eax
  802473:	89 44 24 08          	mov    %eax,0x8(%esp)
  802477:	89 d1                	mov    %edx,%ecx
  802479:	89 f8                	mov    %edi,%eax
  80247b:	d3 e8                	shr    %cl,%eax
  80247d:	8b 4c 24 08          	mov    0x8(%esp),%ecx
  802481:	89 54 24 04          	mov    %edx,0x4(%esp)
  802485:	8b 54 24 04          	mov    0x4(%esp),%edx
  802489:	09 c1                	or     %eax,%ecx
  80248b:	89 d8                	mov    %ebx,%eax
  80248d:	89 4c 24 08          	mov    %ecx,0x8(%esp)
  802491:	89 e9                	mov    %ebp,%ecx
  802493:	d3 e7                	shl    %cl,%edi
  802495:	89 d1                	mov    %edx,%ecx
  802497:	d3 e8                	shr    %cl,%eax
  802499:	89 e9                	mov    %ebp,%ecx
  80249b:	89 7c 24 0c          	mov    %edi,0xc(%esp)
  80249f:	d3 e3                	shl    %cl,%ebx
  8024a1:	89 c7                	mov    %eax,%edi
  8024a3:	89 d1                	mov    %edx,%ecx
  8024a5:	89 f0                	mov    %esi,%eax
  8024a7:	d3 e8                	shr    %cl,%eax
  8024a9:	89 e9                	mov    %ebp,%ecx
  8024ab:	89 fa                	mov    %edi,%edx
  8024ad:	d3 e6                	shl    %cl,%esi
  8024af:	09 d8                	or     %ebx,%eax
  8024b1:	f7 74 24 08          	divl   0x8(%esp)
  8024b5:	89 d1                	mov    %edx,%ecx
  8024b7:	89 f3                	mov    %esi,%ebx
  8024b9:	f7 64 24 0c          	mull   0xc(%esp)
  8024bd:	89 c6                	mov    %eax,%esi
  8024bf:	89 d7                	mov    %edx,%edi
  8024c1:	39 d1                	cmp    %edx,%ecx
  8024c3:	72 06                	jb     8024cb <__umoddi3+0x10b>
  8024c5:	75 10                	jne    8024d7 <__umoddi3+0x117>
  8024c7:	39 c3                	cmp    %eax,%ebx
  8024c9:	73 0c                	jae    8024d7 <__umoddi3+0x117>
  8024cb:	2b 44 24 0c          	sub    0xc(%esp),%eax
  8024cf:	1b 54 24 08          	sbb    0x8(%esp),%edx
  8024d3:	89 d7                	mov    %edx,%edi
  8024d5:	89 c6                	mov    %eax,%esi
  8024d7:	89 ca                	mov    %ecx,%edx
  8024d9:	0f b6 4c 24 04       	movzbl 0x4(%esp),%ecx
  8024de:	29 f3                	sub    %esi,%ebx
  8024e0:	19 fa                	sbb    %edi,%edx
  8024e2:	89 d0                	mov    %edx,%eax
  8024e4:	d3 e0                	shl    %cl,%eax
  8024e6:	89 e9                	mov    %ebp,%ecx
  8024e8:	d3 eb                	shr    %cl,%ebx
  8024ea:	d3 ea                	shr    %cl,%edx
  8024ec:	09 d8                	or     %ebx,%eax
  8024ee:	83 c4 1c             	add    $0x1c,%esp
  8024f1:	5b                   	pop    %ebx
  8024f2:	5e                   	pop    %esi
  8024f3:	5f                   	pop    %edi
  8024f4:	5d                   	pop    %ebp
  8024f5:	c3                   	ret    
  8024f6:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  8024fd:	8d 76 00             	lea    0x0(%esi),%esi
  802500:	29 fe                	sub    %edi,%esi
  802502:	19 c3                	sbb    %eax,%ebx
  802504:	89 f2                	mov    %esi,%edx
  802506:	89 d9                	mov    %ebx,%ecx
  802508:	e9 1d ff ff ff       	jmp    80242a <__umoddi3+0x6a>
